-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
zodios-react key from useXXX is differ from getKeyByXXX #281
Comments
Hope the context is enough for you to fix this. I'm sorry that currently I don't have time to do the PR. |
Thank you for taking the time to report this issue and also to create a reproductible example. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry for delay, not as easy as i thought. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is there any update on this? Really liking the library so far but this "breaks" my hydration setup. I investigated it a bit and it seems like in the |
The Bug
Here is a reproduction CodeSandbox.
The bug is caused by explicitly passing
undefined
as config to auseXXX
. But not ongetKeyByXXX
Workaround
Explicitly pass
{}
togetKeyByXXX
as config.The workaround would NOT work if I try to
getKeyByXXX
on a immutable query. It's becauseuseImmutableQuery
additionally appendbody
to its queryKey.The Root Cause
For
useXXX
params
,queries
and use it to produce the queryKey.pick
function would at least return an empty object even if theobj
isundefined
undefined
config ofuseXXX
produce a{}
in its queryKeyFor
getKeyByXXX
It essentially do the same as
useXXX
. But it checks ifconfig
is passed and then make it part of queryKey.Possible Solution
At first, I believe there is a bug on
pick
implementation. If theobj
isundefined
, it should returnundefined
, too.Fix the Mismatch Behavior between
useXXX
andgetKeyByXXX
.Both these two function needs to derive queryKey from config. So either copy paste the code one another . Or an helper method might be cleaner.
The text was updated successfully, but these errors were encountered: