diff --git a/backlog/tasks/task-026 - Fix-text-shape-sync-between-clients.md b/backlog/tasks/task-026 - Fix-text-shape-sync-between-clients.md index 78971ab..af88f06 100644 --- a/backlog/tasks/task-026 - Fix-text-shape-sync-between-clients.md +++ b/backlog/tasks/task-026 - Fix-text-shape-sync-between-clients.md @@ -1,9 +1,10 @@ --- id: task-026 title: Fix text shape sync between clients -status: To Do +status: Done assignee: [] created_date: '2025-12-04 20:48' +updated_date: '2025-12-25 23:30' labels: - bug - sync @@ -31,7 +32,26 @@ Files to investigate: ## Acceptance Criteria -- [ ] #1 Text shapes sync correctly between multiple clients -- [ ] #2 Text content preserved during automerge serialization/deserialization -- [ ] #3 Both new and existing text shapes display correctly on all clients +- [x] #1 Text shapes sync correctly between multiple clients +- [x] #2 Text content preserved during automerge serialization/deserialization +- [x] #3 Both new and existing text shapes display correctly on all clients + +## Implementation Notes + + +## Fix Applied (2025-12-25) + +Root cause: Text shapes arriving from other clients had `props.text` but the deserialization code was: +1. Initializing `richText` to empty `{ content: [], type: 'doc' }` +2. Then deleting `props.text` +3. Result: content lost + +Fix: Added text → richText conversion for text shapes in `AutomergeToTLStore.ts` (lines 1162-1191), similar to the existing conversion for geo shapes. + +The fix: +- Checks if `props.text` exists before initializing richText +- Converts text content to richText format +- Preserves original text in `meta.text` for backward compatibility +- Logs conversion for debugging +