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

Restore registerRootListener null call #6403

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Restore registerRootListener null call #6403

merged 1 commit into from
Jul 15, 2024

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Jul 15, 2024

Restores the null call I removed in #6389, unfortunately it's a breaking change. Products are using this to do the teardown. For example:

if (prevElement !== null) {
    prevElement.removeEventListener('click', handleClick);
    prevElement.removeEventListener('pointerdown', handlePointerDown);
  }

We may need to introduce a new function/signature and always migrate to it. If we were to mimic React this would be intuitive and wouldn't need to return a fake null rootElement:

registerRootListener(prevElement, nextElement) {
  
  return () => {
    if (prevElement !== null) {
      prevElement.removeEventListener(...);
  }

Copy link

vercel bot commented Jul 15, 2024

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

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2024 4:56pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2024 4:56pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 15, 2024
Copy link

size-limit report 📦

Path Size
lexical - cjs 28.71 KB (0%)
lexical - esm 28.56 KB (0%)
@lexical/rich-text - cjs 37.17 KB (0%)
@lexical/rich-text - esm 28.13 KB (0%)
@lexical/plain-text - cjs 35.82 KB (0%)
@lexical/plain-text - esm 25.48 KB (0%)
@lexical/react - cjs 39.09 KB (0%)
@lexical/react - esm 29.48 KB (0%)

@zurfyx zurfyx added the extended-tests Run extended e2e tests on a PR label Jul 15, 2024
Copy link
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

that didn't last long

@zurfyx
Copy link
Member Author

zurfyx commented Jul 15, 2024

that didn't last long

@ivailop7 haha right, but it's worth pointing out I didn't revert the other PR fully, the nullable condition still remains

@zurfyx zurfyx added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit 0fbab8f Jul 15, 2024
44 checks passed
2wheeh pushed a commit to 2wheeh/lexical that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants