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

Rete js crashes on Safari when a scrollable container is present #716

Open
1 task done
k4v1cs opened this issue Sep 30, 2024 · 2 comments
Open
1 task done

Rete js crashes on Safari when a scrollable container is present #716

k4v1cs opened this issue Sep 30, 2024 · 2 comments
Labels

Comments

@k4v1cs
Copy link

k4v1cs commented Sep 30, 2024

Describe the bug

When there is a textarea with larger content present, so it has a scrollbar, the performance of Rete js greatly suffers, the app becomes unresponsive and in some cases crashes with out of memory error.

Example: https://codesandbox.io/p/sandbox/rete-js-v2-performance-forked-6w67jt
Recording of the issue (with lambdatest): https://github.com/user-attachments/assets/f572f5a3-263e-4e0e-ae7f-7f5cad4dffe5
The issue was also observed on a physical device.

Example to reproduce

https://codesandbox.io/p/sandbox/rete-js-v2-performance-forked-6w67jt

How to reproduce

  • Have a larger number of nodes loaded in the editor
  • Have a container displayed with scrollable content

In Safari the performance becomes vary bad, other browsers are not affected on the same device.

Expected behavior

  • The performance should be the same as without the scrollable container

Dependencies

https://codesandbox.io/p/sandbox/rete-js-v2-performance-forked-6w67jt

Platform

Safari 17 (MacOS Sonoma)

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@k4v1cs k4v1cs added the bug label Sep 30, 2024
@Ni55aN
Copy link
Member

Ni55aN commented Oct 12, 2024

Thanks for reporting, I'll try to debug it asap

@Ni55aN
Copy link
Member

Ni55aN commented Oct 27, 2024

I've tested on the example with updated dependencies: https://codesandbox.io/p/sandbox/rete-js-v2-performance-forked-l4vwyx?workspaceId=53c9a236-3c26-40f8-8bba-91065c593869

Here's what I found while debugging:

  • the page crashes regardless of the initialization of the editor: sometimes during the initialization of the editor, sometimes a few seconds after it has been initialized
  • the crash does not happen with a textarea with long text doesn't have scroll (overflow: 'hidden' or large height)
  • no crashes when textarea is added using JS (second button), not rendered by React.js https://l4vwyx.csb.app/#notextarea

I assume that Safari can't handle a large number of event listeners under certain circumstances, but it's not clear why (Safari's devtools don't give any clues)

Chrome DevTools does not show any anomalies. 90k event listeners is a lot, but not critical
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants