Skip to content

Commit

Permalink
fix: default load typedefiniiton (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ authored Jan 8, 2023
1 parent acf5d34 commit e2d0967
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
5 changes: 3 additions & 2 deletions web/src/components/Editor/JsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ function JsonEditor(props: { value: string; onChange?: (value: string | undefine
onChange(editorRef.current?.getValue());
});
}
}, [onChange]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
if (monacoEl && editorRef.current) {
if (monacoEl && editorRef.current && value !== editorRef.current?.getValue()) {
editorRef.current?.getModel()?.setValue(value);
}
}, [value]);
Expand Down
36 changes: 19 additions & 17 deletions web/src/components/Editor/typesResolve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,25 @@ export class AutoImportTypings {
if (!this.isLoaded("globals")) {
this.loadDeclaration("globals");
}
// if (!this.isLoaded("database-proxy")) {
// this.loadDeclaration("database-proxy");
// }
// if (!this.isLoaded("database-ql")) {
// this.loadDeclaration("database-ql");
// }
// if (!this.isLoaded("axios")) {
// this.loadDeclaration("axios");
// }
// // if (!this.isLoaded('cloud-function-engine')) { this.loadDeclaration('cloud-function-engine') }
// if (!this.isLoaded("mongodb")) {
// this.loadDeclaration("mongodb");
// }
// if (!this.isLoaded("@types/node")) {
// this.loadDeclaration("@types/node");
// }
// if (!this.isLoaded('ws')) { this.loadDeclaration('ws') }
if (!this.isLoaded("database-proxy")) {
this.loadDeclaration("database-proxy");
}
if (!this.isLoaded("database-ql")) {
this.loadDeclaration("database-ql");
}
if (!this.isLoaded("axios")) {
this.loadDeclaration("axios");
}
// if (!this.isLoaded('cloud-function-engine')) { this.loadDeclaration('cloud-function-engine') }
if (!this.isLoaded("mongodb")) {
this.loadDeclaration("mongodb");
}
if (!this.isLoaded("@types/node")) {
this.loadDeclaration("@types/node");
}
if (!this.isLoaded("ws")) {
this.loadDeclaration("ws");
}
}

/**
Expand Down

0 comments on commit e2d0967

Please sign in to comment.