Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pte): cursor presence causes pte error #6622

Merged
merged 3 commits into from May 14, 2024
Merged

fix(pte): cursor presence causes pte error #6622

merged 3 commits into from May 14, 2024

Conversation

pedrobonamin
Copy link
Contributor

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 pedrobonamin requested a review from a team as a code owner May 10, 2024 15:48
Copy link

vercel bot commented May 10, 2024

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented May 10, 2024

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

Since the leaf is now properly rendered for the presence decorator, we are interested in the next nextSibling
skogsmaskin
skogsmaskin previously approved these changes May 13, 2024
Copy link
Member

@skogsmaskin skogsmaskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @pedrobonamin, thank you for this!

I've updated the test to reflect the new DOM structure.

Copy link
Member

@skogsmaskin skogsmaskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @pedrobonamin!

@pedrobonamin pedrobonamin added this pull request to the merge queue May 14, 2024
Merged via the queue into next with commit 23139ba May 14, 2024
39 checks passed
@pedrobonamin pedrobonamin deleted the edx-1311 branch May 14, 2024 09:21
ricokahler pushed a commit that referenced this pull request May 14, 2024
* fix(pte): cursor presence causes pte error

* test(playwright-ct): fix outdated test

Since the leaf is now properly rendered for the presence decorator, we are interested in the next nextSibling

* fix(pte): update tests

---------

Co-authored-by: Per-Kristian Nordnes <per.kristian.nordnes@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants