fix: codemirror crashing due to cursor not updating (#4151)
fix: cursor not updating while filtering
This commit is contained in:
@@ -307,8 +307,8 @@ const jsonResponseBodyText = computed(() => {
|
|||||||
() =>
|
() =>
|
||||||
JSONPath({
|
JSONPath({
|
||||||
path: filterQueryText.value,
|
path: filterQueryText.value,
|
||||||
json: parsedJSON,
|
json: parsedJSON as any,
|
||||||
}) as undefined,
|
}),
|
||||||
(err): BodyParseError => ({
|
(err): BodyParseError => ({
|
||||||
type: "JSON_PATH_QUERY_FAILED",
|
type: "JSON_PATH_QUERY_FAILED",
|
||||||
error: err as Error,
|
error: err as Error,
|
||||||
|
|||||||
@@ -297,7 +297,6 @@ export function useCodemirror(
|
|||||||
options.onUpdate(update)
|
options.onUpdate(update)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update.selectionSet) {
|
|
||||||
const cursorPos = update.state.selection.main.head
|
const cursorPos = update.state.selection.main.head
|
||||||
const line = update.state.doc.lineAt(cursorPos)
|
const line = update.state.doc.lineAt(cursorPos)
|
||||||
|
|
||||||
@@ -310,12 +309,6 @@ export function useCodemirror(
|
|||||||
line: cachedCursor.value.line,
|
line: cachedCursor.value.line,
|
||||||
ch: cachedCursor.value.ch,
|
ch: cachedCursor.value.ch,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cursor.value = {
|
|
||||||
line: cachedCursor.value.line,
|
|
||||||
ch: cachedCursor.value.ch,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update.docChanged) {
|
if (update.docChanged) {
|
||||||
// Expensive on big files ?
|
// Expensive on big files ?
|
||||||
|
|||||||
Reference in New Issue
Block a user