Call queryFn outside query expects meta
I'm using the query key implementation described here : https://tkdodo.eu/blog/leveraging-the-query-function-context#object-query-keys alongside the
initialData NextJS strategy (so fetching the first page in getStaticProps then using the props to initialize query (infinite in this case). Since the queryKey is passed into the queryFn and destructured in the queryFn implementation I now get a warning that meta is missing when simply calling
Is there anything wrong with calling the queryFn with undefined meta in this case? ie - am i overwriting anything RQ fills into the meta or is meta for user-land info only
thanks!Leveraging the Query Function Context
Use what React Query provides for optimal type safety
2 Replies
judicial-coral•4y ago
yeah so if
fetchTodos has the interface of a queryFn (it takes a QueryFunctionContext), then meta is required, but can be undefined.
I've defined meta this way because for react-query, it would be wrong to call this function without passing meta, which is what I wanted to avoidabsent-sapphireOP•4y ago
awesome. Thanks! Just wanted to be sure i wasn't overwriting/preventing any default meta info from being part of the infiniteQuery.