rspace-online/backlog/tasks/task-high.4 - Fix-Automerge...

31 lines
1.0 KiB
Markdown

---
id: TASK-HIGH.4
title: Fix Automerge proxy re-assignment error on canvas load
status: Done
assignee: []
created_date: '2026-03-03 19:17'
updated_date: '2026-03-03 19:18'
labels: []
dependencies: []
parent_task_id: TASK-HIGH
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Fix 'Cannot create a reference to an existing document object' RangeError that fires twice on canvas load (initFromCache + WS sync). Root cause: Automerge proxy objects from doc.shapes passed through DOM elements back into Automerge.change(). Fixed by deep-cloning in #shapeToData() and #updateShapeInDoc().
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 No RangeError in console on canvas hard-refresh
- [x] #2 Shapes persist correctly after move/resize
- [x] #3 Cross-tab sync works without errors
<!-- AC:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Fixed in commit 023a883. Deep-cloned shape data in #shapeToData() and #updateShapeInDoc() to break Automerge proxy chain. Deployed to production.
<!-- SECTION:NOTES:END -->