From 34d9f5aafcf111778b91cf94b1f32a15224e536e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 13 Jun 2026 23:04:10 +0000 Subject: [PATCH] Fix: guard load_plugins() so helper files without a default export don't crash tool init selection_actions.js uses named exports only (no default export). load_plugins() was calling new classObj.default(ctx) on every file in tools/, causing TypeError which aborted render_main_tools() -> render_main_gui() -> leaving menu and toolbar blank. Added null guard and per-file try/catch, matching the defensive pattern already added to load_modules(). https://claude.ai/code/session_01WVDg7amsy1TTtxvpku7bcM --- frontend/src/js/core/gui/gui-tools.js | 33 +++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/frontend/src/js/core/gui/gui-tools.js b/frontend/src/js/core/gui/gui-tools.js index e574010..a60a553 100644 --- a/frontend/src/js/core/gui/gui-tools.js +++ b/frontend/src/js/core/gui/gui-tools.js @@ -46,23 +46,28 @@ class GUI_tools_class { moduleKey = parts[parts.length - 1]; } - var classObj = plugins_context(key); - var object = new classObj.default(ctx); + try { + var classObj = plugins_context(key); + if (!classObj.default) return; // skip helper files without a default export + var object = new classObj.default(ctx); - var title = _this.Helper.ucfirst(object.name); - title = title.replace(/_/, ' '); + var title = _this.Helper.ucfirst(object.name); + title = title.replace(/_/, ' '); - _this.tools_modules[moduleKey] = { - key: moduleKey, - full_key: full_key, - name: object.name, - title: title, - object: object, - }; + _this.tools_modules[moduleKey] = { + key: moduleKey, + full_key: full_key, + name: object.name, + title: title, + object: object, + }; - //init events once - if(typeof object.load != "undefined") { - object.load(); + //init events once + if(typeof object.load != "undefined") { + object.load(); + } + } catch(e) { + console.error('[load_plugins] Failed to load ' + key + ':', e); } } });