fix: disable schema awareness when object resource (#2343)

This commit is contained in:
HugoCasa
2023-09-26 20:12:34 +02:00
committed by GitHub
parent dc44b0841a
commit ff1b4df1ac
3 changed files with 22 additions and 4 deletions
+8 -2
View File
@@ -235,8 +235,14 @@
let command: Disposable | undefined = undefined
let sqlSchemaCompletor: Disposable | undefined = undefined
$: args &&
(dbSchema = $dbSchemas[(lang === 'graphql' ? args.api : args.database)?.replace('$res:', '')])
function updateSchema(lang, args) {
const schemaRes = lang === 'graphql' ? args.api : args.database
if (schemaRes instanceof String) {
dbSchema = $dbSchemas[schemaRes.replace('$res:', '')]
}
}
$: args && updateSchema(lang, args)
$: dbSchema && ['sql', 'graphql'].includes(lang) && addDBSchemaCompletions()
$: (!dbSchema || lang !== 'sql') && sqlSchemaCompletor && sqlSchemaCompletor.dispose()
$: (!dbSchema || lang !== 'graphql') && graphqlService && graphqlService.setSchemaConfig([])
@@ -104,7 +104,13 @@
$: !$generatedCode && hideDiff()
$: dbSchema = $dbSchemas[(lang === 'graphql' ? args.api : args.database)?.replace('$res:', '')]
function updateSchema(lang, args) {
const schemaRes = lang === 'graphql' ? args.api : args.database
if (schemaRes instanceof String) {
dbSchema = $dbSchemas[schemaRes.replace('$res:', '')]
}
}
$: updateSchema(lang, args)
</script>
{#if SUPPORTED_LANGUAGES.has(lang)}
@@ -146,7 +146,13 @@
$: editor && setSelectionHandler()
$: selection && (isEdit = !selection.isEmpty())
$: dbSchema = $dbSchemas[(lang === 'graphql' ? args.api : args.database)?.replace('$res:', '')]
function updateSchema(lang, args) {
const schemaRes = lang === 'graphql' ? args.api : args.database
if (schemaRes instanceof String) {
dbSchema = $dbSchemas[schemaRes.replace('$res:', '')]
}
}
$: updateSchema(lang, args)
</script>
{#if $generatedCode.length > 0 && !genLoading}