Typesafe query keys

Hey I am curious how do you guys manage your query keys and keep track of them. In a complex application managing them and keeping track of which one to invalidate seems hard for me. Is there an option to make them somehow typesafe? I haven't found any good articles on this topic :/
2 Replies
stanisław
stanisławOP2y ago
I see there is a lib "query key factory". Is it a way to go?
Neto
Neto2y ago
i mostly use based on context
['products'] // all products
['products', 'some-id'] // single product
['products', 'search', 'some-option1', 'some-option2'] // product search
['products'] // all products
['products', 'some-id'] // single product
['products', 'search', 'some-option1', 'some-option2'] // product search
then you can become very granular with the invalidation or simply invalidate(['products']) and let rq refetch
Want results from more Discord servers?
Add your server