Skip to content

Commit

Permalink
feat: fix issue when index is not select #10
Browse files Browse the repository at this point in the history
Signed-off-by: seven <[email protected]>
  • Loading branch information
Blankll committed Jan 6, 2024
1 parent c97d6ad commit 72023d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/views/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ const executeQueryAction = async (
});
return;
}
const data = await searchQDSL(established.value.activeIndex.index, payload);
const data = await searchQDSL(established.value?.activeIndex?.index, payload);
displayEditor.getModel().setValue(JSON.stringify(data, null, ' '));
} catch (err) {
const { status, details } = err as CustomError;
Expand All @@ -176,12 +175,14 @@ const setupQueryEditor = (code: string) => {
});
// Register language injection rule
queryEditor.onKeyUp(event => refreshActionMarks(queryEditor));
queryEditor.onKeyUp(event => queryEditor && refreshActionMarks(queryEditor));
queryEditor.onMouseDown(({ event, target }) => {
if (
event.leftButton &&
target.type === 4 &&
Object.values(target!.element!.classList).includes(executionGutterClass)
Object.values(target!.element!.classList).includes(executionGutterClass) &&
queryEditor &&
displayEditor
) {
executeQueryAction(queryEditor, displayEditor, target.position);
}
Expand Down

0 comments on commit 72023d4

Please sign in to comment.