Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: codemirror crashing due to cursor not updating (#4151)
Nivedinfe79c47d1f2a
diff --git a/packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vue b/packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vueindex f9ae2f42a..91f2d8db4 100644--- a/packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vue+++ b/packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vue@@ -307,8 +307,8 @@ const jsonResponseBodyText = computed(() => {() =>JSONPath({path: filterQueryText.value,- json: parsedJSON,- }) as undefined,+ json: parsedJSON as any,+ }),(err): BodyParseError => ({type: "JSON_PATH_QUERY_FAILED",error: err as Error,diff --git a/packages/hoppscotch-common/src/composables/codemirror.ts b/packages/hoppscotch-common/src/composables/codemirror.tsindex a2a4d25e2..c2005f027 100644--- a/packages/hoppscotch-common/src/composables/codemirror.ts+++ b/packages/hoppscotch-common/src/composables/codemirror.ts@@ -297,19 +297,12 @@ export function useCodemirror(options.onUpdate(update)}- if (update.selectionSet) {- const cursorPos = update.state.selection.main.head- const line = update.state.doc.lineAt(cursorPos)-- cachedCursor.value = {- line: line.number - 1,- ch: cursorPos - line.from,- }-- cursor.value = {- line: cachedCursor.value.line,- ch: cachedCursor.value.ch,- }+ const cursorPos = update.state.selection.main.head+ const line = update.state.doc.lineAt(cursorPos)++ cachedCursor.value = {+ line: line.number - 1,+ ch: cursorPos - line.from,}cursor.value = {