diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-resource/src/PluginBootstrap.ts b/webapp/packages/plugin-sql-editor-navigation-tab-resource/src/PluginBootstrap.ts index e69924c358..1d345c2c39 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-resource/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab-resource/src/PluginBootstrap.ts @@ -160,15 +160,24 @@ export class PluginBootstrap extends Bootstrap { try { const nodeInfo = await contexts.getContext(this.navNodeManagerService.navigationNavNodeContext); const node = await this.navNodeInfoResource.load(data.nodeId); + const resource = await this.navResourceNodeService.loadResourceInfo(node.id); if (node.nodeType !== RESOURCE_NODE_TYPE || !isScript(node.id)) { return; } - const resource = await this.navResourceNodeService.loadResourceInfo(node.id); - if (!resource) { - throw new Error('Resource not found'); + if (data.type === NavigationType.open) { + throw new Error('Resource not found'); + } else { + return; + } + } + + nodeInfo.markOpen(); + + if (data.type !== NavigationType.open) { + return; } const maxSize = this.sqlEditorSettingsService.settings.getValue('maxFileSize'); @@ -184,12 +193,6 @@ export class PluginBootstrap extends Bootstrap { return; } - nodeInfo.markOpen(); - - if (data.type !== NavigationType.open) { - return; - } - const tab = this.sqlEditorTabResourceService.getResourceTab(node.id); if (tab) {