Repository navigation
Split the base-node-viewer god-component - #1577
Conversation
base-node-viewer.svelte was ~2237 lines mixing collection management, viewer-local hydration, header handling, placeholder-promotion reactivity, schema-form loading, component loading, and per-row rendering. Two problems dominated its size: scattered pure helpers inline in the script, and ~450 lines of near-duplicated template — every node row rendered twice (plugin component branch + BaseNode fallback branch) with nearly identical inline event handlers. Extract the row rendering into node-row.svelte, which renders the plugin-vs-fallback branch once and re-exposes the node events to the viewer as callback props. The handler bodies move up into the viewer as single named methods. Extract the pure/stateless concerns (cursor utils, schema-field update, fallback content/metadata, node-type predicate) into plain .ts siblings, and the two reactive component loaders into .svelte.ts store-classes. Consolidate the core-node-type predicate that had drifted into a private twin in navigation-service into one shared node-type-predicates module. Reconcile a latent inconsistency: the fallback branch's nodeTypeChanged promoted a placeholder synchronously while every other promotion path defers via tick() and gates on isPromoting. The unified handler uses the tick-deferred, isPromoting-guarded path, removing the state_unsafe_mutation risk the sync path carried. Also drop the dead write-only expandedState map (a #580-transition leftover nothing read). Viewer drops from ~2237 to ~1526 lines; behavior unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
🔍 Pragmatic Code Review — PR #1577 (Split base-node-viewer god-component, #1518)Review Type: Initial Review
Requirements Check
📝 Notes
Code Review FindingsOverall this is a clean, disciplined extraction. Behavior is preserved except for two intentional changes (the 🟢 Verified correct — behavior preservation
🟢 Verified correct — intentional changes
🟢 Verified correct — CSS move
🟢 Dedup
🟢 Standards
🟡 Minor (non-blocking) — optional follow-ups
Recommendation: APPROVE (assessment)A well-scoped, low-risk refactor that meets both acceptance criteria. The duplication is genuinely eliminated (not merely relocated), the one behavioral reconciliation is an improvement that removes a Merge remains the human author's call. |
The pragmatic review noted the on:taskStateChanged binding on the plain BaseNode fallback branch is inert (only task-node.svelte dispatches that event), so it fires only via the plugin-component branch. Add a comment so a future reader doesn't mistake it for a live path. Kept for branch symmetry — no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
✅ Address-review summaryThe review returned APPROVE with no 🔴 critical and no blocking 🟡 findings — the three 🟡 items were explicitly marked "no action needed / not in scope / intended." Addressed (1):
Skipped (2), with reasoning:
Verification: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The only change since the review is a one-line clarifying comment with zero logic impact. No critical/important issues were addressed, no functionality changed, no refactoring performed. The PR is ready for merge (pending the author's decision). |
Closes #1518