Files
malkuthro-ComfyUI-Koolook/web/koolook_sidebar.js
malkuthroandClaude Opus 4.7 215616f546 revert(sidebar): drop drag-link-release menu priority patch (#79)
The patch in `web/sidebar/connection_menu.js` was reorder-only — it sorted
existing menu items so curated picks floated to the top. In practice
ComfyUI's drag-link-release menu has its own pre-filter that surfaces only
~4 stock nodes per socket type (e.g. for an IMAGE-compatible drop target:
VAEEncode, VAEEncodeForInpaint, SaveImage, PreviewImage). Most user
picks never appear in that filtered list, so the reorder had nothing to
hoist and the feature was invisible in practice.

A useful version of this would have to ADD picks to the menu — walk the
user's curated picks, type-match each against the dragged socket, inject
matches as new menu items — rather than just reorder. That's a larger
patch and out of scope for tonight; filing as a follow-up rather than
shipping dead code.

Removed: `web/sidebar/connection_menu.js`, the `patchConnectionMenu`
import + call in `web/koolook_sidebar.js`, and the corresponding
[Unreleased] CHANGELOG entry.

Kept: spotlight-on-add, modal drag-out fix, and the `pinExpanded`
buildFolder fix from #76 — all independently useful.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 21:35:04 +02:00

53 lines
2.1 KiB
JavaScript

// =============================================================================
// Koolook curated-nodes sidebar — entry point.
//
// This file boots the sidebar; module bodies live in `web/sidebar/`. ComfyUI
// discovers the extension via `WEB_DIRECTORY = "./web"` (set in __init__.py)
// and calls `app.registerExtension(...).setup()` once during frontend startup.
// =============================================================================
import { app } from "../../../scripts/app.js";
import {
TAB_ID,
TAB_TITLE,
TAB_TOOLTIP,
TAB_ICON,
} from "./sidebar/constants.js";
import { seedStarterPresetIfNeeded } from "./sidebar/snapshot.js";
import {
loadWorkflowsStore,
seedWorkflowDefaultsIfNeeded,
} from "./sidebar/workflows_store.js";
import { renderPanel } from "./sidebar/tree.js";
import { patchCanvasMenu } from "./sidebar/canvas_menu.js";
app.registerExtension({
name: "koolook.curated_sidebar",
async setup() {
if (!app.extensionManager || !app.extensionManager.registerSidebarTab) {
console.warn("[Koolook] extensionManager.registerSidebarTab not available; sidebar not registered.");
return;
}
// Seeds the bundled starter preset into the user's snapshot library
// on first run (replaces the legacy `curated_defaults.json` localStorage
// pick-seed). Async-fires server I/O — kept off the critical path so
// sidebar tab registration isn't blocked behind it on a slow server.
seedStarterPresetIfNeeded();
const loadResult = await loadWorkflowsStore();
// Skip workflow seeding when /userdata file is corrupt — we don't want
// to overwrite a recoverable-but-unparseable file with stock defaults.
if (!loadResult.corrupt) {
await seedWorkflowDefaultsIfNeeded();
}
app.extensionManager.registerSidebarTab({
id: TAB_ID,
title: TAB_TITLE,
tooltip: TAB_TOOLTIP,
icon: TAB_ICON,
type: "custom",
render: (el) => renderPanel(el),
});
patchCanvasMenu();
},
});