TanStackT
TanStackโ€ข2y agoโ€ข
8 replies
full-green

`exhaustive-deps` not complaining about `window.location.origin` anymore

Hey,

in our codebase we are using window.location.origin inside our queryFn. Previously the exhaustive-deps check was complaining if we did not include it in the key. But if we did I think some kind of error occurred (can not really recall right now). So we ended up with something like

// disable because queryKey should be independent from window location
// eslint-disable-next-line @tanstack/query/exhaustive-deps
queryKey: ['campaigns', 'list', parkId, filters],


Now we implemented a new query where we have the same kind of setup using the window location again. The new queryKey did not complain about the window missing. So we checked at the other places and also the older queries don't complain anymore.

Has the rule changed?
And in general: What would be the best practise for using window properties inside queryFn - include it in the key? Don't?

Thanks in advance ๐Ÿ™‚
Was this page helpful?