Replies: 3 comments 4 replies
-
Like the error message says, async atoms don't work in sync, and it can't update the input. I wonder if Conceptually, something like this: const asyncAtom = atom(...)
const syncAtom = atom(...)
const finalAtom = atom(
(get) => get(syncAtom) || get(asyncAtom),
(get, set, newValue) => {
set(syncAtom, newValue)
set(asyncAtom, newValue)
}
) |
Beta Was this translation helpful? Give feedback.
-
I got this Error on iOS when using export const App = () => {
return (
<Suspense fallback={<SplashScreen />}>
<InnerApp />
</Suspense>
);
}; |
Beta Was this translation helpful? Give feedback.
-
I am trying to combine jotai-query and jotai-effect together and work on something like this: export const coachInfoAtom = atomWithQuery(get => {
return {
queryKey: ['coachInfo'],
queryFn: () =>
contentfulControllerFindAllCoaches(
{
query: {
lang: `en`,
},
}),
};
});
export const coachAgentsAtom = atomWithStorage( 'coachAgents',
null,
storage,
{getOnInit: true},
)
export const coachMetaEffect = atomEffect((get, set) => {
// runs on mount or whenever coachInfoAtom changes, then extract coachAgents into the atom
const value = get(coachInfoAtom)
set(coachAgentsAtom, value?.data?.data?.data?.coachAgents).then(r => console.log(r))
}) And react native will throw the |
Beta Was this translation helpful? Give feedback.
-
I get this error only on android and It's coming from the root component (App)
This is the line causing the issue: atomWithStorage('somethingToStore', null, createJSONStorage(() => AsyncStorage))
Beta Was this translation helpful? Give feedback.
All reactions