Repository navigation
Add editable header area to BaseNodeViewer - #362
Merged
malibio merged 9 commits intoOct 31, 2025
Merged
Conversation
Implements a consistent header editing experience across all node viewers by adding an always-visible editable header to BaseNodeViewer. ## Changes - Added editable header input to BaseNodeViewer - Header displays and allows editing of the node's content field - Changes to header update both the node's content in database and tab title - Borderless design with no focus indicators (NodeSpace philosophy) - Simplified compared to DateNodeViewer (no icon, no navigation arrows) ## Implementation Details - Header content synced with node content via $effect - Tab title updates automatically when header content changes - Uses SharedNodeStore.updateNode for database persistence - Follows same styling patterns as DateNodeViewer header but simplified ## Acceptance Criteria ✅ Header area added to BaseNodeViewer with date-viewer-style design ✅ Header is always visible (not optional) ✅ Header contains editable text input with no borders/focus indicators ✅ Changes to header update the node's content field in database ✅ Tab title updates when header text changes ✅ No icon or navigation arrows (unlike DateNodeViewer) ✅ Consistent with NodeSpace's borderless design philosophy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
#361) Corrects the implementation to properly handle the header display logic: - DateNodeViewer (and other viewers with custom headers) provide their own header snippet - BaseNodeViewer shows a default editable header ONLY when no custom snippet is provided - Uses {:else} block to conditionally render default vs custom header This ensures DateNodeViewer continues showing its date navigation header, while other viewers without custom headers get the editable title input. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
The header input was calling sharedNodeStore.updateNode() directly with VIEWER_SOURCE, which was trying to CREATE the node instead of UPDATE it because the node wasn't marked as persisted in the persistedNodeIds set. Changed to use nodeManager.updateNodeContent() which follows the same pattern as all other node content updates in the system. This ensures: - Consistent update behavior across all node edits - Proper UPDATE vs CREATE detection - Content processing and reference updates - Debounced persistence 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changed headerContent from $state to $derived to ensure it stays in sync with the node's content from any source (edits in child nodes, other viewers, etc.). This provides full reactivity across all viewers and ensures the header always displays the current node content, regardless of where changes originate. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…361) Root cause fix for database persistence logic. Previously, nodes loaded from backend via navigation (link clicks) were not marked as persisted, causing subsequent updates to incorrectly attempt CREATE instead of UPDATE operations, resulting in 500 errors. Changes: - Modified setNode() to automatically mark nodes as persisted when skipPersistence=true (indicates node already exists in backend) - Removed redundant persistedNodeIds.add() calls in loadChildrenForParent() since setNode() now handles this automatically - Updated navigation-service.ts with clarifying comment This ensures all nodes loaded from backend (whether via loadChildrenForParent or navigation links) are consistently tracked as persisted, preventing duplicate CREATE attempts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Previously, tab title updates weren't working because headerContent was derived from sharedNodeStore.getNode() which doesn't provide Svelte reactivity. The $derived wouldn't react to changes in the underlying Map. Solution: - Changed headerContent to use $state instead of $derived - Initialize headerContent from node when nodeId changes - Update tab title immediately in handleHeaderInput() when user types - Use bind:value on input for two-way binding with local state This creates a simple, direct flow: user input → update tab title → save to DB The tab title now updates in real-time as the user types in the header. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adds horizontal line below the editable header to match the visual treatment of DateNodeViewer's custom header. This provides consistent visual separation between the header area and content area across all viewer types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Removed padding-bottom override (0.5rem) so editable header uses uniform 1rem padding like the date header, ensuring consistent spacing and height (81px) across all viewer types. Before: 73px height (16px top, 8px bottom) After: 81px height (16px all sides) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements all recommendations from pragmatic code review including critical fixes, improvements, and comprehensive test coverage. ## Changes ### Critical Fixes - **Fix input binding redundancy**: Changed from two-way `bind:value` to one-way `value` binding with explicit `oninput` handler to prevent double-execution of update logic on every keystroke - **Add error handling**: Wrapped `nodeManager.updateNodeContent()` in try-catch block with console error logging for failed updates ### Code Quality Improvements - **Extract shared utility**: Created `text-formatting.ts` utility with `formatTabTitle()` function and `MAX_TAB_TITLE_LENGTH` constant - **Update BaseNodeViewer**: Now uses shared utility for consistent tab title formatting with improved documentation - **Update NavigationService**: Refactored to use shared utility, eliminating code duplication and magic numbers - **Simplify comments**: Reduced redundant comment in shared-node-store ### Testing - **Comprehensive test coverage**: Added 24 unit tests for text-formatting utility covering all edge cases, unicode, multi-line content, and real-world scenarios ## Technical Details **Input Binding Fix:** - Before: `bind:value` + `oninput` caused double updates - After: One-way `value` binding with single `oninput` handler - Impact: Eliminates redundant function calls and potential race conditions **Shared Utility Benefits:** - Single source of truth for tab title truncation logic - Consistent MAX_TAB_TITLE_LENGTH = 40 across all components - Eliminates maintenance hazard of duplicated logic - Well-documented with comprehensive examples **Test Coverage:** - Short/long title handling - Multi-line content extraction - Unicode and emoji support - Edge cases and boundary conditions - Real-world usage scenarios All quality checks pass (lint, format, type-check, tests). Closes #361 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
malibio
deleted the
feature/issue-361-editable-header-base-node-viewer
branch
October 31, 2025 02:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #361