facebookexperimental / Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
https://recoiljs.org/
MIT License
19.61k stars 1.18k forks source link

async recoil-sync and nextjs, page won't load #2238

Open hainessss opened 1 year ago

hainessss commented 1 year ago

Hey there, been stuck on this issue awhile:

When using the RecoilSync component with an async read prop, the nextJs server gets stuck and the page won't load. no error is thrown.

Here is a super simple reproduction: https://github.com/hainessss/recoil-sync-next

This also happens with next 12.

Any ideas what needs to be done to get this working? thanks

hainessss commented 1 year ago

adding a default to the atom gets the server unstuck. but then the syncEffect doesn't populate the atom

hainessss commented 1 year ago

Think the answer here is actually to just use Jotai. This project seems effectively dead. Which is too bad because I was really enjoying working with it.

CamJohnson26 commented 1 year ago

Any update on this? Running into the same thing with recoil-sync

clockk commented 1 year ago

why not use default value in myList atom ?

https://github.com/hainessss/recoil-sync-next/blob/main/src/pages/MyList.tsx#L7