sanity icon indicating copy to clipboard operation
sanity copied to clipboard

fix(pte): cursor presence causes pte error

Open pedrobonamin opened this issue 9 months ago • 3 comments

Description

Structure consistently crashes withCannot resolve a DOM point from Slatepoint when editing a document with multiple users I've been debugging this and it seems to be generated because the PresenceCursor element is not rendering the Leaf that is generated in the editable component, which causes that the editable leaf "dissapears" and crashes the editor.

This were the original steps to reproduce the issue: Steps to reproduce

  • User 1: Create a new document with a PTE field
  • User 2: visit the same URL
  • User 1: focus the PTE field
  • User 2: focus the PTE field
  • User 1: enter a line break
  • User 2's screen will indicate that the current caret has shifted down, even though they haven't done anything (This hasn't been fixed, not sure how to think it @skogsmaskin any thoughts? )
  • User 2: focus the PTE field
  • User 1's structure will then crash
  • User 1: click retry
  • User 1: re-focus the PTE field, navigate to the second line and hit ENTER to line break
  • User 1: observe how the caret hasn't changed position
  • User 1: hit ENTER again
  • User 2: refocus the PTE field and press the up arrow key

With the changes introduced I was not able to reproduce the issue anymore,

User 1's structure will then crash

What to review

Testing

Notes for release

pedrobonamin avatar May 10 '24 15:05 pedrobonamin

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 4:18pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 4:18pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 4:18pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 4:18pm

vercel[bot] avatar May 10 '24 15:05 vercel[bot]

No changes to documentation

github-actions[bot] avatar May 10 '24 15:05 github-actions[bot]

Component Testing Report Updated May 13, 2024 4:23 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 5s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 22s 9 0 0

github-actions[bot] avatar May 10 '24 15:05 github-actions[bot]