Query Key factory best practice for filters
Is it ok to keep query key in this format? in here we have used a single key called
sortCriteria to keep pagination and filter information.
Or is it more advised to create separate keys for each filter keys(more flattened)?
Current:
Flattened:
3 Replies
flat-fuchsia•4y ago
I don't think there's any difference when it comes to query targeting, for example for invalidation.
yelping-magentaOP•4y ago
true, it doesnt affect the query
deep-jade•4y ago
I'd make this decision based on the way the data typically exists in your app and what's the most convenient way to consume the query for your components. Is it easier to pass them in as a nested object or flattened?