From 15576751dade458ddc8cf7b6c005a32e6fd05667 Mon Sep 17 00:00:00 2001 From: Wroud Date: Mon, 4 Jul 2022 15:57:25 +0300 Subject: [PATCH] fix(plugin-sql-editor-navigation-tab-resource): CB-2122 error message on context menu opening --- .../src/PluginBootstrap.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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) {