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

Bug: clicking a material ui button with preact signals present crashes react with Uncaught Error: Should have a queue. This is likely a bug in React. Please file an issue. #26704

Closed
insberr opened this issue Apr 23, 2023 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@insberr
Copy link

insberr commented Apr 23, 2023

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

  1. Add a preact signal somewhere
  2. Add a MUI button
  3. Click the button
  4. 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

@insberr insberr added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Apr 23, 2023
@gaearon
Copy link
Collaborator

gaearon commented Apr 25, 2023

In addition to overriding React's public API, Preact Signals works by taking React internals and patching them while relying on fragile assumptions about how they work. This library is an entirely unsupported way to use React. The only reason it isn't constantly breaking is that we haven't done stable releases recently.

If React was a piece of hardware, this is exactly the kind of thing that voids the warranty. We can't help with debugging issues here, and we don't consider them bugs because so much has been meddled with.

If you have a repro case that doesn't rely on Preact Signals, we'd like to have a look. Thanks.

@benemmaofficial
Copy link

At least they got State Mangement right. Instead of talking about how they meddled with the ergonomics of React, isn't it better to learn from what they have done, to find a way to officially support Signals.

Its just more linear and feels natural to work with. I almost wonder why the core team had to make initial state management a pain with things like the reducer pattern which introduces a whole bunch of of issues.

If react where a design canvas on a scale of 10 it would be ranked very poorly. Ranking react at (2) would be very modest.

We all look at Signals and think useState, useReducer, useSelector, Actions, Dispatchs etc... are state management primitives the react core team designed to sound smart.

They are inefficient, long, hard, unnatural and just outright unpleasant to work with a concept like Signals completely render all those concepts redundant.

Lastly the preact team may have patched a few bits and pieces to make Signals work for the most part but at least they made State Management digestible.

And I suggest React does the same.

TLDR: The only reason we use JS is because of React and the only reason we use React is because of meta frameworks like NEXTJS
& REMIX.

I speak for most or all react developers.
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants