"Too much recursion" - Using a falsy value in the query key to stall useQuery call #535
Unanswered
michaeljblum
asked this question in
General
Replies: 3 comments
-
Try |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hmmm that doesn't seem to make a difference. I'll work more on this later. And thanks for all your work on this! Absolutely loved your Hawaii JSConf talk on custom hooks, server state vs cache state and the like. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to try using react-query in my application instead of custom hooks I've been using to interface with Firebase, but I'm running into some issues.
Everything works fine in my component using this code
I know I can't call useQuery in useEffect, so I'm setting my firebase variable (the return value of my useFirebase hook above) as the second part of my query key below, and reading it in my queryFn (fetchTodos), like so
My thinking is that fetchTodos would only be called when firebase evaluates to true. I keep getting "InternalError: too much recursion" here, though.
My interest in using react-query here with firebase would be to avoid having a global context provider, as is possible with my custom hook/function called in useEffect pattern. But I'm stumbling on getting useQuery to work here.
Beta Was this translation helpful? Give feedback.
All reactions