How to access individual customer by ID after a search with TanStack Query?
Hi, working on a React Native app with Expo Router + TanStack Query and could use some advice on caching patterns.
what i have:
In another screen, I allow selecting a customer and passing only their id back. Later, I want to fetch the full customer data using just the ID, ideally from the query cache .
Because customers are cached under ['customers', search], I can't access them directly by ['customer', id] later — unless I search thru that key wich is meh..
any suggestion? Idk if this is right but ideally i would need ['customer', customer.id]
what i have:
In another screen, I allow selecting a customer and passing only their id back. Later, I want to fetch the full customer data using just the ID, ideally from the query cache .
Because customers are cached under ['customers', search], I can't access them directly by ['customer', id] later — unless I search thru that key wich is meh..
any suggestion? Idk if this is right but ideally i would need ['customer', customer.id]