From 8ca059cf4a80087a03ff5c6278023a5cf8dc6eb7 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Thu, 16 Dec 2021 01:41:36 +0530 Subject: [PATCH] fix: broken render due to regression in store --- .../components/graphql/RequestOptions.vue | 4 ++-- .../helpers/editor/linting/preRequest.ts | 24 ++++++++++++------- .../helpers/editor/linting/testScript.ts | 24 ++++++++++++------- packages/hoppscotch-app/pages/index.vue | 6 +++-- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/packages/hoppscotch-app/components/graphql/RequestOptions.vue b/packages/hoppscotch-app/components/graphql/RequestOptions.vue index 226461553..fb5cc8044 100644 --- a/packages/hoppscotch-app/components/graphql/RequestOptions.vue +++ b/packages/hoppscotch-app/components/graphql/RequestOptions.vue @@ -5,7 +5,7 @@ :id="'query'" :label="`${t('tab.query')}`" :selected="true" - :indicator="gqlQueryString.length > 0" + :indicator="gqlQueryString && gqlQueryString.length > 0 ? true : false" >
{ results = results.concat( semanticLints.map((lint: any) => ({ - from: lint.from, - to: lint.to, + from: { + ch: lint.from.ch + 1, + line: lint.from.line + 1, + }, + to: { + ch: lint.from.ch + 1, + line: lint.to.line + 1, + }, severity: "error", message: `[semantic] ${lint.message}`, })) @@ -24,12 +30,12 @@ const linter: LinterDefinition = async (text) => { results = results.concat( res.errors.map((err: any) => { const fromPos: { line: number; ch: number } = { - line: err.lineNumber - 1, - ch: err.column - 1, + line: err.lineNumber, + ch: err.column, } const toPos: { line: number; ch: number } = { - line: err.lineNumber - 1, + line: err.lineNumber, ch: err.column, } @@ -42,14 +48,14 @@ const linter: LinterDefinition = async (text) => { }) ) } - } catch (e) { + } catch (e: any) { const fromPos: { line: number; ch: number } = { - line: e.lineNumber - 1, - ch: e.column - 1, + line: e.lineNumber, + ch: e.column, } const toPos: { line: number; ch: number } = { - line: e.lineNumber - 1, + line: e.lineNumber, ch: e.column, } diff --git a/packages/hoppscotch-app/helpers/editor/linting/testScript.ts b/packages/hoppscotch-app/helpers/editor/linting/testScript.ts index 902d1778c..75d193f82 100644 --- a/packages/hoppscotch-app/helpers/editor/linting/testScript.ts +++ b/packages/hoppscotch-app/helpers/editor/linting/testScript.ts @@ -10,8 +10,14 @@ const linter: LinterDefinition = async (text) => { results = results.concat( semanticLints.map((lint: any) => ({ - from: lint.from, - to: lint.to, + from: { + ch: lint.from.ch + 1, + line: lint.from.line + 1, + }, + to: { + ch: lint.from.ch + 1, + line: lint.to.line + 1, + }, severity: "error", message: `[semantic] ${lint.message}`, })) @@ -24,12 +30,12 @@ const linter: LinterDefinition = async (text) => { results = results.concat( res.errors.map((err: any) => { const fromPos: { line: number; ch: number } = { - line: err.lineNumber - 1, - ch: err.column - 1, + line: err.lineNumber, + ch: err.column, } const toPos: { line: number; ch: number } = { - line: err.lineNumber - 1, + line: err.lineNumber, ch: err.column, } @@ -42,14 +48,14 @@ const linter: LinterDefinition = async (text) => { }) ) } - } catch (e) { + } catch (e: any) { const fromPos: { line: number; ch: number } = { - line: e.lineNumber - 1, - ch: e.column - 1, + line: e.lineNumber, + ch: e.column, } const toPos: { line: number; ch: number } = { - line: e.lineNumber - 1, + line: e.lineNumber, ch: e.column, } diff --git a/packages/hoppscotch-app/pages/index.vue b/packages/hoppscotch-app/pages/index.vue index e2eb9148a..4888692c1 100644 --- a/packages/hoppscotch-app/pages/index.vue +++ b/packages/hoppscotch-app/pages/index.vue @@ -46,7 +46,9 @@ @@ -54,7 +56,7 @@