From 3f19d9bc11021db188ed2e9e72f5bcf5c7cb0f44 Mon Sep 17 00:00:00 2001 From: malkuthro <166633396+malkuthro@users.noreply.github.com> Date: Wed, 6 May 2026 16:55:42 +0200 Subject: [PATCH] =?UTF-8?q?fix(sidebar):=20drop=20pinned=20Modules=20folde?= =?UTF-8?q?r=20=E2=80=94=20name-collides=20with=20user=20dirs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Slice 2 from #97 added a virtual "Modules" folder at the top of the Workflows section listing every module-tagged workflow flat. In practice it collides visually with any user-created directory also named "Modules" (the tree shows two same-named folders containing the same entries) and conflates module-ness with location. Modules are a property (the `module` tag), not a place — saving a module into a user folder shouldn't synthesize a parallel pinned location. Discovery is already adequate via: - The Tags section's `module` folder (existing — flat list). - The green pi-plus-circle icon on module rows in their native folders (existing per #82). Slice 1 (auto-default Save-as-module on subgraph canvases) and slice 4 (subgraph definitions in serialize/insert) are unchanged and still deliver the rest of #97's scope. --- web/sidebar/tree.js | 58 +-------------------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/web/sidebar/tree.js b/web/sidebar/tree.js index 2e64753..9dcc4a4 100644 --- a/web/sidebar/tree.js +++ b/web/sidebar/tree.js @@ -1040,34 +1040,7 @@ function gatherWorkflows(query) { const q = (query || "").trim().toLowerCase(); const stats = { total: 0 }; const directories = gatherDirsAt([], q, stats); - const modules = gatherModuleEntries(q); - return { directories, total: stats.total, modules }; -} - -// Flat list of every active `module`-tagged workflow, for the pinned -// "Modules" folder rendered at the top of the Workflows section. Search -// filters by workflow name only (the pinned view is a quick-access surface; -// the canonical directory tree below still respects directory-name match). -function gatherModuleEntries(q) { - const out = []; - const walk = (parentPath) => { - for (const dirName of listDirectoryNames(parentPath)) { - const dirPath = [...parentPath, dirName]; - const dir = dirOf(dirPath); - if (!dir) continue; - for (const [wfName, wf] of Object.entries(dir.workflows || {})) { - if (wf.archived === true) continue; - const tags = Array.isArray(wf.tags) ? wf.tags : []; - if (!tags.includes(MODULE_TAG)) continue; - if (q && !wfName.toLowerCase().includes(q)) continue; - out.push({ wfName, path: dirPath }); - } - walk(dirPath); - } - }; - walk([]); - out.sort((a, b) => compareNames(a.wfName, b.wfName)); - return out; + return { directories, total: stats.total }; } function gatherDirsAt(parentPath, q, stats) { @@ -1956,35 +1929,6 @@ addSection({ return gatherWorkflows(q); }, build(ctx) { - // Pinned "Modules" folder — flat list of every module-tagged - // workflow regardless of folder, rendered above the directory - // tree. Click inserts (the row's makeWorkflowLeafRow inherits - // the module convention via isModule: true). Hidden entirely - // when no modules exist so the section doesn't grow noise for - // users who haven't tagged anything yet. - const modules = Array.isArray(ctx.data.modules) ? ctx.data.modules : []; - if (modules.length > 0) { - ctx.folder({ - name: "Modules", - count: modules.length, - iconKind: "folder", - path: "__modules__", - startExpanded: true, - build: (modCtx) => { - for (const m of modules) { - modCtx.leaf({ - row: makeWorkflowLeafRow({ - name: m.wfName, - dirName: m.path.join(" / "), - onClick: () => insertWorkflowOntoCanvas(m.path, m.wfName), - onContextMenu: (e) => workflowRowContextMenu(e, m.path, m.wfName, false), - isModule: true, - }), - }); - } - }, - }); - } for (const dir of ctx.data.directories) renderGatheredDir(ctx, dir); }, });