-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
Describe the bug
To Reproduce
const DemoA = () => {
return (
<Suspense fallback={'loading'}>
<Works />
</Suspense>
);
};
const DemoB = () => {
return (
<Suspense fallback={'loading'}>
<NotWork />
</Suspense>
);
};
const Works: React.FC = () => {
// status success success success
console.log(
'status',
[1, 2, 3]
.map(
(v) =>
({
queryKey: ['users', v],
queryFn: fetchApi,
suspense: true,
} as UseQueryOptions),
)
.map(useQuery)
.map(({ status }) => status),
);
return null;
};
const NotWork: React.FC = () => {
// status loading loading loading
// status success loading loading
// status success success loading
// status success success success
console.log(
'status',
useQueries(
[1, 2, 3].map(
(v) =>
({
queryKey: ['users', v],
queryFn: fetchApi,
suspense: true,
} as UseQueryOptions),
),
).map(({ status }) => status),
);
return null;
};Expected behavior
useQueries should works like the useQuery loop, the result status should be success
Screenshots
Desktop (please complete the following information):
- OS: macOS
- Browser: chrome
- Version: react-query@3.5.5
Additional context
tbergquist-godaddy, lukaszmakuch, jezzgoodwin, ryrudnev, ppiyush13 and 12 more