maas-ui
maas-ui copied to clipboard
Old API used in Tanstack Query provider
Describe the issue
- Tanstack query changed its API in v5, renaming
cacheTime
togcTime
. - Since v4, query keys are always arrays
maas-ui version maas-ui 3.6.0
Expected behavior
-
gcTime
instead ofcacheTime
should be used in query-client.tsx, e.g.:
type QueryOptions = NonNullable<DefaultOptions>["queries"];
export const defaultQueryOptions: QueryOptions = {
staleTime: 5 * 60 * 1000, // 5 minutes
gcTime: 15 * 60 * 1000, // 15 minutes
refetchOnWindowFocus: true,
};
export const realTimeQueryOptions: QueryOptions = {
staleTime: 0,
gcTime: 60 * 1000, // 1 minute
};
- ternary from base.tsx might be removed
const queryModelKey = Array.isArray(queryKey) ? queryKey[0] : ""; // const queryModelKey = queryKey[0];
Additional context
- Migration guide to v5 (gcTime): https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-v5#rename-cachetime-to-gctime
- Migration guide to v4 (keys as arrays): https://tanstack.com/query/v4/docs/framework/react/guides/migrating-to-react-query-4#query-keys-and-mutation-keys-need-to-be-an-array
Recently, I was experimenting with different cloud solutions, but then I found MAAS - looks quite interesting!
By statically reading the code, I found these small improvements. Unfortunately, I can't open a PR with my proposal as I have some issues with the local websocket proxy server - it seems like the MAAS local instance closes the connection immediately. "I'll try to prepare a reproduction demo on Ubuntu in the future. If the problem recurs, I'll open an issue on Launchpad. :crossed_fingers: