feat: maintain field-lock information on the Visual Builder canvas#625
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
1790871 to
1c42cac
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Mirror entry field-lock state in the canvas SDK so a field a collaborator is editing shows as locked to peers and cannot be edited until they move off it. Locks resolve per entry with container propagation, the affordance reuses the field-disabled treatment, and the mirror stays in sync with the parent through a snapshot request and live updates. Co-Authored-By: Claude <noreply@anthropic.com>
1c42cac to
99f2c6e
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Address review feedback on the field-lock canvas work: - generateLockAvatar: add window.scrollX to the avatar's left offset. The badge is positioned absolutely from getBoundingClientRect (viewport coordinates); top already added scrollY but left omitted scrollX, so the badge drifted on a horizontally scrolled canvas. - mouseClick: run the peer-lock edit gate before sendMouseClickPostMessage. A click on a field locked by another user now returns before posting MOUSE_CLICK, so it no longer cancels the current user's own pending lock release. The gate is guarded by eventDetails so a genuine empty-space click still posts (deselect / inline-edit metadata) unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
What
When two people edit the same entry, a field one of them is editing now shows as locked to the other on the canvas, and cannot be edited until they move off it. The lock clears when the peer deselects the field, navigates away, or disconnects.
How
The canvas keeps a read-only mirror of the parent's lock state per entry and paints the locked state on hover, reusing the existing field-disabled treatment (dashed outline, cursor, label, and the editor's avatar). Trying to edit a locked field is blocked before the inline editor opens.
The mirror stays fresh through an initial snapshot and live updates from the parent, with a retry when a fetch fails, a guard so a stale snapshot cannot overwrite a newer update, and a subscription so the locked state re-renders the moment it changes.
Testing
Unit tests cover lock resolution, the mirror, the snapshot exchange, the hover and click handling, and the field label. Run with
npm test.🤖 Generated with Claude Code