()
| 1376 | const states: Array<UseQueryResult<number>> = [] |
| 1377 | |
| 1378 | function FirstComponent() { |
| 1379 | const state = useQuery(() => ({ |
| 1380 | queryKey: key, |
| 1381 | queryFn: () => sleep(10).then(() => 1), |
| 1382 | })) |
| 1383 | |
| 1384 | createRenderEffect(() => { |
| 1385 | states.push({ ...state }) |
| 1386 | }) |
| 1387 | |
| 1388 | return ( |
| 1389 | <div> |
| 1390 | <button onClick={() => state.refetch()}>refetch</button> |
| 1391 | data: {state.data} |
| 1392 | </div> |
| 1393 | ) |
| 1394 | } |
| 1395 | |
| 1396 | function SecondComponent() { |
| 1397 | useQuery(() => ({ |