You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see i initialized first state with initializeState, i also provided atom to the observer
I ve been using renderHook which gonna be rendered behind the scene in some test component.
For my atom i use families because i need to, and PRODUCT_SET_ID is unique ID for each "family" for that purposes.
I am using the same PRODUCT_SET_ID for atom, and i am using the same imagesAtom as i use in the project.
My hook uses this atom as well inside, to provide a possibility to the functions (image actions) to change the state.
So basically, my expectations that the hook and RecoilRoot and RecoilObserver should share the same atom family, because all of them use the same imagesAtom and all of them have the same PRODUCT_SET_ID. But i guess it is not true
The issue
It looks like they are disconnected.
During the test when i invoke
I get
amount of calls 1
and last toHaveBeenCalledWith does not have ADD_IMAGES its still just have INIT_IMAGES only
My question is how can i make this kind of connection in the right way? What am i missing?
Or what i am doing it is an antipattern and it should be used in some other way?
The text was updated successfully, but these errors were encountered:
I have a custom hook
useImageActions
which returns a set of functionsEach function makes some things like mutations with GQL, or else and update the state with the result with recoil.
From your documentation i used
RecoilObserver
and i came up with this solutionAs you can see i initialized first state with
initializeState
, i also providedatom
to the observerI ve been using
renderHook
which gonna be rendered behind the scene in some test component.For my atom i use families because i need to, and
PRODUCT_SET_ID
is unique ID for each "family" for that purposes.I am using the same
PRODUCT_SET_ID
foratom
, and i am using the sameimagesAtom
as i use in the project.it looks like this
My hook uses this atom as well inside, to provide a possibility to the functions (image actions) to change the state.
So basically, my expectations that the hook and
RecoilRoot
andRecoilObserver
should share the same atom family, because all of them use the sameimagesAtom
and all of them have the samePRODUCT_SET_ID
. But i guess it is not trueThe issue
It looks like they are disconnected.
During the test when i invoke
I get
amount of calls 1
and last
toHaveBeenCalledWith
does not haveADD_IMAGES
its still just haveINIT_IMAGES
onlyMy question is how can i make this kind of connection in the right way? What am i missing?
Or what i am doing it is an antipattern and it should be used in some other way?
The text was updated successfully, but these errors were encountered: