query-key-factory
query-key-factory copied to clipboard
A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
is there a way to make sure, that when I pass `initialData`, the query result comes back as DefinedUseQuery? reproduction: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYygUwIYzQRQK5pQCeA0mkQM4A0cAKkWGgCYCqFuBxA8mDMBADsKcAL5wAZlAgg4AcgACAGzwBrNCGgZFaCgHoAjpyIBaNSfEZkMaEVkAoUJFiI4edvkJFREqTIUwMIQDkFV10SxhjQ097O2RBCnhxCAg4AF4UcOwPYjJKAApZZIhZGgQ7OEq4ACMMKAAuOHyzRsSoYAEAcwBKdIA+JvKq4bho3PJGgG0zAF0qCpHKsaIAMQFG-N60gYAFX2B2ADp0CghFADc0fJgoAm6FypF7p7s4hPg3NBWU9KaWuDaHU6NAgvH4QgA-I16IxWO4jDw+AkADwwBhoCDiCQpQ61KB9LYDIZVdAwPBQASueGefLExaHBmgpFCeaLSoMw7FXF1ZrkbqsqovESveJBUZGX6fb4QQrFUouDrAPhaAAiWAwjRuBFE91FiTgTHVv2Wh0NATsul0IwAehCgA
Hello! I ran into a small issue when trying to use the library. It seems that the `staleTime` is not available in types when using a static query without any...
The fix added here: https://github.com/lukemorales/query-key-factory/commit/9b5401cdd8ff6b3a85074285ab7ed68a6ab3a252 locked down the valid factory keys to `'queryKey' | 'queryFn' | 'contextQueries'` however this removes the ability to utilize `placeholderData` as specified here: https://tanstack.com/query/latest/docs/framework/react/guides/placeholder-query-data This...
Hi. I was trying to implement queryKeyStore that I could use in Nextjs in both SSR and client-side. In order to prefetch, I need to call the defined function but...
Hi, Typically we use react-query in the following way, by writing a small reusable hook, ex: ```ts // Example of request vars type EventRequestVariables { count: number; filter: Record, skip:...
Taking this from the example: ```typescript export const users = createQueryKeys('users', { list: () => ({ queryKey: [], queryFn: () => api.findAll(), }), }); export function useUserList() { return useQuery(users.list);...
As I start to use this library, I noticed the following pattern coming up quite a bit.. ``` const users = createQueryKeys('users', { byId: ({ id }) => ({ queryKey:...
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYygUwIYzQRQK5pQCeA0mkQM4A0cAKkWGgCYCqFuBxA8mDMBADsKcAL5wAZlAgg4AcgACAGzwBrNCGgZFaCgHoAjpyIBaNSfEZkMaEVkAoO8kEV44iBDgBeFOiwdCpOQUABSybhCyNAh2cLFwAEYYUABccMFmXnAARNguWQCUXgB8adFxcLq65QB6APwx5XGGAWREqQDaZgC6VA2NcM3EAGICqcGFniUAClIgwOwAdOgUEIoAbmjBMFAE+X2ieyJ7dkA
I'm wondering using variable is possible. here is my current query key for example ```typescript function test(a: string, b: string) { return useQuery({ queryKey: ["key_one", a, "key_two", b], queryFn: ()...