TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
42.72k stars 2.93k forks source link

**perf** better timeout handling #8096

Closed joeljeske closed 1 month ago

joeljeske commented 2 months ago

This minor tweak reduces the number of setInterval/clearInterval/clearTimeout calls that are made, which improves performance by not needing to interact with native timers, which are slower than JS calls.

nx-cloud[bot] commented 1 month ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f6ec0ac97c027cec3d88d53b138aeed94dd09c72. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target - [`nx run-many --target=build --exclude=examples/** --exclude=integrations/**`](https://cloud.nx.app/runs/0eyQQ8a2mW?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

More templates

- [@tanstack/query-example-angular-basic](https://pkg.pr.new/template/862dbcc9-a868-4165-b904-2edb30960c90) - [@tanstack/query-example-angular-infinite-query-with-max-pages](https://pkg.pr.new/template/e9168cf0-b3d4-4c05-b97d-fd4b4223de8e) - [@tanstack/query-example-angular-pagination](https://pkg.pr.new/template/9fb75940-8318-45ff-8069-bd8aa644c220) - [@tanstack/query-example-angular-router](https://pkg.pr.new/template/77557a2b-cb7d-4c8f-a6d0-eb18e084a5f6) - [@tanstack/query-example-angular-rxjs](https://pkg.pr.new/template/a0bc96ce-17a3-450b-b6bc-5923056fbf65) - [@tanstack/query-example-angular-simple](https://pkg.pr.new/template/31797fdd-4f81-4554-81f9-382e0e353874) - [@tanstack/query-example-solid-astro](https://pkg.pr.new/template/0ae895c5-f477-461e-83fd-9d7dc6f71219) - [@tanstack/query-example-solid-basic](https://pkg.pr.new/template/71c02b2d-a5a5-4e9b-9003-22fc345f13ef) - [@tanstack/query-example-solid-basic-graphql-request](https://pkg.pr.new/template/808b0a99-7232-4093-9b47-874c6b1019e1) - [@tanstack/query-example-solid-default-query-function](https://pkg.pr.new/template/17106e2f-635d-4b82-84fc-9ba66a4232f1) - [@tanstack/query-example-solid-simple](https://pkg.pr.new/template/30cb7ecb-b206-4d5e-95fd-672dea0f61c5) - [@tanstack/query-example-solid-start-streaming](https://pkg.pr.new/template/ca2263e0-064d-48df-9484-1588a49a9278) - [@tanstack/query-example-react-algolia](https://pkg.pr.new/template/e6a29100-0c0d-446e-a119-a13ffa81cb3f) - [@tanstack/query-example-react-auto-refetching](https://pkg.pr.new/template/a04fb2ab-f2bc-4eed-bee8-ee3c53d78a89) - [@tanstack/query-example-react-basic](https://pkg.pr.new/template/e32dfec3-1e41-4f19-8554-c2075e44d769) - [@tanstack/query-example-react-basic-graphql-request](https://pkg.pr.new/template/ffbff11b-c113-4b51-b1f4-4b833e70e21d) - [@tanstack/query-example-react-default-query-function](https://pkg.pr.new/template/0adcdc50-3451-4659-9a88-2cbafab62cef) - [@tanstack/query-example-react-devtools-panel](https://pkg.pr.new/template/781d220d-b027-4d8a-9f43-949156f9c961) - [@tanstack/query-example-react-infinite-query-with-max-pages](https://pkg.pr.new/template/f1aa3dfb-e4b8-4518-9908-fd771e21cec2) - [@tanstack/query-example-react-load-more-infinite-scroll](https://pkg.pr.new/template/c1933ace-104a-4819-96df-9399a3475dd9) - [@tanstack/query-example-react-nextjs](https://pkg.pr.new/template/0ae58741-18e0-4101-bd2b-370ad72c0873) - [@tanstack/query-example-react-nextjs-app-prefetching](https://pkg.pr.new/template/442cfe2d-a4d0-494e-b6a7-0326fa4b88f5) - [@tanstack/query-example-nextjs-suspense-streaming](https://pkg.pr.new/template/3a433aff-f053-440f-b8d9-364f70fbe400) - [@tanstack/query-example-react-offline](https://pkg.pr.new/template/23f40b81-2b9a-4f08-960a-de89f73ff721) - [@tanstack/query-example-react-optimistic-updates-cache](https://pkg.pr.new/template/d6927da3-2d9d-433e-96f8-2a19c5b8a852) - [@tanstack/query-example-react-optimistic-updates-ui](https://pkg.pr.new/template/120fa9f7-fa81-42ba-b2d4-cb2f026aee55) - [@tanstack/query-example-react-pagination](https://pkg.pr.new/template/38aaf67e-4d52-4478-93c4-824e3dd6cf0f) - [@tanstack/query-example-react-playground](https://pkg.pr.new/template/aa998c71-c771-4518-8330-272ffd279224) - [@tanstack/query-example-react-prefetching](https://pkg.pr.new/template/925140fe-2033-4abd-aa5b-148f61289640) - [@tanstack/query-example-react-react-native](https://pkg.pr.new/template/af74855f-5a35-4f05-8e73-29db0f529e90) - [@tanstack/query-example-react-router](https://pkg.pr.new/template/0ba4a405-3c73-4204-b6ff-09f0031410db) - [@tanstack/query-example-react-rick-morty](https://pkg.pr.new/template/a70e686c-6cea-4ab7-8f09-8d19c5269959) - [@tanstack/query-example-react-shadow-dom](https://pkg.pr.new/template/f7ebc4bf-36bd-478a-9809-f20bb6cdf697) - [@tanstack/query-example-react-simple](https://pkg.pr.new/template/a0e63273-591d-4230-854a-ec8a6d1f1fac) - [@tanstack/query-example-react-star-wars](https://pkg.pr.new/template/ef4a9102-b2ea-495a-bc8f-c90e9cf8d092) - [@tanstack/query-example-react-suspense](https://pkg.pr.new/template/c34db082-24be-453a-8ce0-413349af0c8c) - [@tanstack/query-example-svelte-auto-refetching](https://pkg.pr.new/template/ad5cbb56-9440-4e2a-9073-0fa0ecd2655d) - [@tanstack/query-example-svelte-basic](https://pkg.pr.new/template/4ded687e-3a11-41ad-a80e-94127011469e) - [@tanstack/query-example-svelte-load-more-infinite-scroll](https://pkg.pr.new/template/8b34393f-7048-4f28-987b-6fa793ec0a35) - [@tanstack/query-example-svelte-playground](https://pkg.pr.new/template/ce60d6f8-7233-41a5-9cd8-0dc9f5d3000c) - [@tanstack/query-example-svelte-optimistic-updates](https://pkg.pr.new/template/0d8226cd-0177-44cc-b22b-fab45a91bb58) - [@tanstack/query-example-svelte-simple](https://pkg.pr.new/template/ec1cdee6-540c-4451-972d-ee1916e7b62d) - [@tanstack/query-example-svelte-ssr](https://pkg.pr.new/template/1013dbde-0d4b-499b-80d5-9dbc7120d793) - [@tanstack/query-example-svelte-star-wars](https://pkg.pr.new/template/115eb4be-10c3-4768-a80b-7d2bfd0c277a) - [@tanstack/query-example-vue-2.6-basic](https://pkg.pr.new/template/ce4eea4d-a531-4429-8b9b-2bd2edb34403) - [@tanstack/query-example-vue-2.7-basic](https://pkg.pr.new/template/e65f6b1c-bba2-4708-8bbc-e60502a4989a) - [@tanstack/query-example-vue-basic](https://pkg.pr.new/template/d091a295-d82b-4845-8fcc-7a2c2f21522d) - [@tanstack/query-example-vue-dependent-queries](https://pkg.pr.new/template/bc67a7d9-c3a4-455b-b9dc-6d76cc60cc0d) - [@tanstack/query-example-vue-nuxt3](https://pkg.pr.new/template/c1781410-42f8-4295-9720-e5885bcbbf1d) - [@tanstack/query-example-vue-persister](https://pkg.pr.new/template/aaa10ee9-013e-42da-a099-8fd608801b3f) - [@tanstack/query-example-vue-simple](https://pkg.pr.new/template/bae76288-fc39-49ae-b2d7-89eb13bc00c7)

@tanstack/angular-query-devtools-experimental

``` pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8096 ```

@tanstack/eslint-plugin-query

``` pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@8096 ```

@tanstack/angular-query-experimental

``` pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@8096 ```

@tanstack/query-async-storage-persister

``` pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@8096 ```

@tanstack/query-broadcast-client-experimental

``` pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8096 ```

@tanstack/query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/query-devtools@8096 ```

@tanstack/query-core

``` pnpm add https://pkg.pr.new/@tanstack/query-core@8096 ```

@tanstack/query-persist-client-core

``` pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@8096 ```

@tanstack/query-sync-storage-persister

``` pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@8096 ```

@tanstack/react-query

``` pnpm add https://pkg.pr.new/@tanstack/react-query@8096 ```

@tanstack/react-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@8096 ```

@tanstack/react-query-next-experimental

``` pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@8096 ```

@tanstack/react-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@8096 ```

@tanstack/solid-query

``` pnpm add https://pkg.pr.new/@tanstack/solid-query@8096 ```

@tanstack/solid-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@8096 ```

@tanstack/solid-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@8096 ```

@tanstack/svelte-query

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query@8096 ```

@tanstack/svelte-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@8096 ```

@tanstack/vue-query

``` pnpm add https://pkg.pr.new/@tanstack/vue-query@8096 ```

@tanstack/svelte-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@8096 ```

@tanstack/vue-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@8096 ```

commit: f6ec0ac

TkDodo commented 1 month ago

I think the failing test around intervals shows that this approach is not correct.