Open
Description
I've got a use case where a query takes a bunch of data as input. Like a lot. So since I don't want to end up with a cache key that's huge, I implemented serializeQueryArgs and provided a suitable replacement that uniquely represents the data in a manageable size string identifier with no collisions, perfect for a cache key. Imagine my surprise when i'm seeing long running attempts at memoizing a json the size of Texas and when i trace it I find this:
const stableArg = useStableQueryArgs(
options.skip ? skipToken : arg,
// Even if the user provided a per-endpoint `serializeQueryArgs` with
// a consistent return value, _here_ we want to use the default behavior
// so we can tell if _anything_ actually changed. Otherwise, we can end up
// with a case where the query args did change but the serialization doesn't,
// and then we never try to initiate a refetch.
defaultSerializeQueryArgs,
context.endpointDefinitions[endpointName],
endpointName,
)
The comment feels like it's treating the user as dumb. Is there a way to avoid this?
In short: I have a parameter that i need in queryFn and I don't want the library to ever try to serialize it.
Metadata
Metadata
Assignees
Labels
No labels