preactjs / signals

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

`Out-of-order effect` error thrown with `react-router-dom` #540

Closed nathan-prijot closed 3 months ago

nathan-prijot commented 3 months ago

I'm encountering the error Out-of-order effect and I cannot find information about what this error means. It happens in a custom hook using a signal when react-router-dom makes a navigation back to the component using this custom hook.

Replacing the .value in the custom hook to a .peek() fixed the issue but of course it no longer update the component. It's probably something to do with my implementation but I would like to have some insight as to why this error is thrown so I can identify the faulty usage.

XantreDev commented 3 months ago

Do you use 2.0.1 version with babel plugin?

nathan-prijot commented 3 months ago

I am using the 2.0.0 version with the useSignals hook. I do no use the babel plugin.

XantreDev commented 3 months ago

Can you provide repro in codesandbox or stackblitz? I have an assumption that it can be cause when component rerenders itself recursively

rschristian commented 3 months ago

Closing, reproductions are necessary if you want us to be able to help.

We can reopen this if a reproduction is provided.