-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Describe the bug
The array returned by useQueries is not stable between render cycles which makes it unusable for anything down the line that uses shallow equality to determine if something had changed.
Small snippet to illustrate the bug
const responses = useQueries(preparedQueries);
console.log("changed?");
useEffect(() => console.log("changed!"), [responses]);
Console output
changed?
changed!
changed?
changed!
...
Expected behavior
The return value of useQueries is stable between render cycles as long as the queries did not change. The returned value can be used as a dependency for hooks like useMemo/useEffect which use shallow equality checks to determine if a dependency had changed since the last render
Desktop (please complete the following information):
- OS: Linux
- Browser: Firefox
- Version: 86
Additional context
The new behavior was introduced via #1775.
Relevant code lines:
Metadata
Metadata
Assignees
Labels
No labels