preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.82k stars 95 forks source link

Using React, clicking a material ui button with preact signals present crashes react #517

Closed cafesanu closed 8 months ago

cafesanu commented 8 months ago

Hello, my team is in the process of reasearching Preact Signal to use it in our React 18 project. We also use MUI (latest) and while investigating, we found this issue in the React repo, but I think it belongs here.

Here is the link https://github.com/facebook/react/issues/26704 but I will copy pasta the issue here anyway. Any insights?

When there are preact signals (@preact/signals-react) and a Material UI button (or any MUI element with the ripple animation on it) is clicked, React crashes with the errors: Uncaught Error: Should have a queue. This is likely a bug in React. Please file an issue.. I have included a screenshot of the errors and a link to a codesandbox with a replication of the error. Its the ripple animation on Material UI elements that seems to be involved in the crash. Disabling the ripple animation makes the button work and React does not crash. The ripple animation only crashes React when preact signals are present. Its a combined issue between React, MUI, and Preact signals.

If this issue is not because of React or a React bug, it would be very helpful if someone could help me figure out what's causing it so I can report it to the correct place (ie. MUI or Preact signals)

image

React version: 18.2.0

Steps To Reproduce Add a preact signal somewhere Add a MUI button Click the button React Crashes Link to code example: https://codesandbox.io/s/react-crash-replication-o24v4p?file=/src/App.tsx

The current behavior React crashes

The expected behavior React doesnt crash

Thanks!

XantreDev commented 8 months ago

Which version of preact signals do you use? Probably it eariler than 2.0.0, if so - preact signals changed the way it's integrates in react. For now you need to use babel plugin for it. Check the readme

cafesanu commented 8 months ago

yeah that example was using 1.3. I'll give it a try with latest version and can reopen if I see the issue