Repository navigation
Description
Overview
When typing content into a placeholder node and clicking away (blur) without pressing Enter, the content disappears and the node is not saved.
Steps to Reproduce
- Navigate to a date node or any container node that shows an empty placeholder
- Click into the placeholder to start editing
- Type some content (e.g., "test content" or inline markdown like
**bold**) - Click away from the node (blur) WITHOUT pressing Enter
- Expected: Content should be saved and node should persist
- Actual: Content disappears, placeholder resets to empty state
Analysis
The placeholder promotion logic in base-node-viewer.svelte only triggers in the contentChanged handler when:
currentPlaceholderexistsnode.id === currentPlaceholder.idcontent.trim() !== ''nodeIdexists (parent node ID)
However, the blur event handler in base-node.svelte (lines 641-661) does NOT trigger any persistence or promotion logic - it only:
- Clears the editing state via
focusManager.clearEditing() - Hides autocomplete modal
This means if the user types content but blurs before any condition triggers promotion, the placeholder content is lost.
Root Cause
The contentChanged event fires on every input, so theoretically promotion should happen. However, there may be a race condition or timing issue where:
- Content is typed
contentChangedfires and promotion starts- User blurs before promotion completes
- Blur clears editing state
- Placeholder is garbage collected with unsaved content
Or alternatively, the promotion condition is not being met for some reason (need to investigate which condition is failing).
Relevant Code Locations
- Blur handler:
packages/desktop-app/src/lib/design/components/base-node.sveltelines 641-661 - Placeholder promotion:
packages/desktop-app/src/lib/design/components/base-node-viewer.sveltelines 1269-1333 - viewerPlaceholder derived:
packages/desktop-app/src/lib/design/components/base-node-viewer.sveltelines 116-132 - shouldShowPlaceholder:
packages/desktop-app/src/lib/design/components/base-node-viewer.sveltelines 1150-1155
Potential Fixes
- Fire contentChanged on blur: Ensure the final content state is sent before blur clears editing
- Add blur handler for placeholder promotion: Check if placeholder has content on blur and promote it
- Investigate race condition: Add logging to understand why promotion isn't completing
Acceptance Criteria
- Placeholder content persists when user clicks away (blur)
- Placeholder content persists when user presses Enter (existing behavior)
- No regression in normal node editing
- Tests added for blur-based placeholder persistence
Activity
Fix placeholder content lost on blur without Enter key (closes #681)
Fix placeholder promotion causing 409 Conflict errors on typing (closes
Fix placeholder promotion state_unsafe_mutation error (closes #681)
Placeholder node content lost on blur without Enter key (#683)
Placeholder node content lost on blur without Enter key (#683)
Placeholder node content lost on blur without Enter key (#683)
Placeholder node content lost on blur without Enter key (#683)