Skip to content
Discussion options

You must be logged in to vote

we pollute query-cache with irrelevant information (same as for class instance exposing UUID);

This is a valid argument. However I would just use queryKeyHashFn, and define your dependencies, like TkDodo says as well.
However, if you really don't want to do this, I guess you could try to use the same idea as above with queryKeyHashFn. It does seem a bit hacky though. But it would mean you don't pollute your keys directly - just the hash. But you need different hashes if the reference change...

const useReferentialQueryKeyHashFn = (deps) => {
  const [updateCount, setUpdateCount] = React.useState(0);

  React.useEffect(() => {
    setUpdateCount((cnt) => cnt + 1);
  }, deps);

  return ([k…

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
10 replies
@justsaul
Comment options

@Birkbjo
Comment options

Answer selected by justsaul
@TkDodo
Comment options

@Birkbjo
Comment options

@TkDodo
Comment options

@Birkbjo
Comment options

Comment options

You must be logged in to vote
2 replies
@justsaul
Comment options

@TkDodo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants