1.9 KiB
1.9 KiB
| id | title | status | assignee | created_date | updated_date | labels | dependencies | priority | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| task-026 | Fix text shape sync between clients | Done | 2025-12-04 20:48 | 2025-12-25 23:30 |
|
high |
Description
Text shapes created with the "T" text tool show up on the creating client but not on other clients viewing the same board.
Root cause investigation:
- Text shapes ARE being persisted to R2 (confirmed in server logs)
- Issue is on receiving client side in AutomergeToTLStore.ts
- Line 1142: 'text' is in invalidTextProps list and gets deleted
- If richText isn't properly populated before text is deleted, content is lost
Files to investigate:
- src/automerge/AutomergeToTLStore.ts (sanitization logic)
- src/automerge/TLStoreToAutomerge.ts (serialization logic)
- src/automerge/useAutomergeStoreV2.ts (store updates)
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
Implementation Notes
Fix Applied (2025-12-25)
Root cause: Text shapes arriving from other clients had props.text but the deserialization code was:
- Initializing
richTextto empty{ content: [], type: 'doc' } - Then deleting
props.text - 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.textexists before initializing richText - Converts text content to richText format
- Preserves original text in
meta.textfor backward compatibility - Logs conversion for debugging