Unexpected behaviour with Vue Query's persist plugin: deserialize
method not always called
#7783
Unanswered
nikolakrajinovic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm experiencing an issue with Vue Query's persist plugin where the
deserialize
method is not always being called as expected. This is causing inconsistent behavior in my components, as sometimes the data passed to theselect
function is serialized, even though it should always be the return type ofqueryFn
, which in my case is a Model class instance (CiDetails
).Here's the relevant part of my code:
I've confirmed that the deserialize method in my
LocalStorageQuerySerializer
class is correctly implemented and should return aCiDetails
instance. However, the debugger statement inside the select function is sometimes hit, indicating that the data is serialized, and in these cases, the debugger statement insideLocalStorageQuerySerializer.deserialize
is not hit:I did notice that in these cases,
deserialize
is called immediately after the firstselect
call, which hits the debugger statement insidedeserialize
, after whichselect
is called again with correctly deserialized data. Interestingly enough, when the data passed toselect
is not an instance ofCiDetails
, it is still an object, and not a string.I would expect the deserialize method to always be called before the select function, ensuring that the data is always deserialized. Is there something I'm missing, or is this a potential bug?
Any help would be greatly appreciated.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions