T
TanStack2y ago
conscious-sapphire

structuralSharing=true should return same object on unchanged data even if queryKey changes

I thought structuralSharing=true will always return the same object reference if the server data is unchanged regardless of changes done in the queryKey. Is this a wrong assumption?
2 Replies
optimistic-gold
optimistic-gold2y ago
Different key = different cache entry so there is nothing to share
conscious-sapphire
conscious-sapphireOP2y ago
Ok off course, thanks fir the quick reply for* A possible way to handle is to cache ourself the oldData and compare it with the new and return the same object reference in queryFn if no changes were found?

Did you find this page helpful?