Closed otwm closed 3 years ago
I found the cause... This is not a bug. This was what happened with useDeepMemo working as the parameters changed due to recoil. If possible, assigning a variable at the moment of execution would prevent this from happening. Close the issue.
Intended outcome: In lazyQuery, it works only when the function is called exactly.
Actual outcome: When using lazyQuery, the query works once, and then the next execution, even without actually executing the query. This appears when using 'recoil' together. Details are explained with examples in the reproduction section below.
How to reproduce the issue:
When you have the above code,
If you proceed with the above procedure, executeSome1Lazy in step 3 is executed even if the condition is not met in the function in useEffect. To be precise, when useSome1LazyQuery is executed, it seems to be executed.
As a result of debugging, useDeepMemo in useBaseQuery is executed, and the result In QueryData's executeLazy function, runLazy is set to true, and as a result, it was confirmed that the query was executed unintentionally.
I'm not sure, but I guess carefully if the current method wasn't designed to take into account when used with 'recoil'.
Versions 3.2.2