retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10.15k stars 654 forks source link

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

Open k4v1cs opened 1 month ago

k4v1cs commented 1 month ago

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

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

Expected behavior

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

Ni55aN commented 1 month ago

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

Ni55aN commented 2 weeks ago

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:

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