-
Notifications
You must be signed in to change notification settings - Fork 11
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
atomWithLocation initVaule is not sync #37
Comments
Thanks for reporting. Let's see if @Flirre has an opinion. |
I'll try to take a proper look at it during the weekend 👀 |
I won't have time to investigate this. On a high level it seems like a nice fix, but I'm not sure either about Concurrent React. Could that be checked with some tests? |
@Flirre Thanks for the note. It's too hard to test actually. @WeiShengv99 If I understand correctly, the issue can be hidden from the user. Let me know if you have a real issue other than performance problem or unexpected internal behavior. If anyone is interested in this issue, feel free to jump in. |
@dai-shi @Flirre Thank you for your work. Yes,users can add an extra const innerLocationAtom = atomWithLocation({
replace: true,
});
const isInitAtom = atom(false);
const locationAtom = ((get) => get(innerLocationAtom),(_get, set, update: boolean) => {
set(isInitAtom, update);
},)
locationAtom.onMount = (setAtom) => {
setAtom(true);
return () => {
setAtom(false);
};
} If return |
https://stackblitz.com/edit/github-3vpjew?file=src%2FApp.tsx
jotai-location/src/atomWithLocation.ts
Lines 86 to 97 in 8e7194d
maybe we can return
getL()
when baseAtom not mount. not justget(baseAtom
The text was updated successfully, but these errors were encountered: