Skip to content

Commit

Permalink
Merge branch 'main' into zhihengGet/main
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Jul 14, 2024
2 parents 1f0c8c0 + 79e5202 commit 80d77b5
Show file tree
Hide file tree
Showing 222 changed files with 2,031 additions and 5,971 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: override release tag
required: false
push:
branches: ['main', 'alpha', 'beta', 'rc', 'v4']
branches: [main, alpha, beta, rc, v4]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand All @@ -16,6 +16,10 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: write
id-token: write

jobs:
test-and-publish:
name: Test & Publish
Expand All @@ -42,7 +46,7 @@ jobs:
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run cipublish
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read

jobs:
test:
name: Test
Expand All @@ -28,8 +31,8 @@ jobs:
- name: Get base and head commits for `nx affected`
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'main'
- name: Run Tests
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- name: Stop Nx Agents
if: ${{ always() }}
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
link-workspace-packages=true
prefer-workspace-packages=true
provenance=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.2.0
22.4.0
42 changes: 42 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function readPackage(pkg, context) {
// react-scripts@4.0.3
if (pkg.name === 'react-scripts' && pkg.version === '4.0.3') {
delete pkg.dependencies['@typescript-eslint/eslint-plugin']
delete pkg.dependencies['@typescript-eslint/parser']
delete pkg.dependencies['babel-eslint']
delete pkg.dependencies['babel-jest']
delete pkg.dependencies['eslint']
delete pkg.dependencies['eslint-config-react-app']
delete pkg.dependencies['eslint-plugin-flowtype']
delete pkg.dependencies['eslint-plugin-import']
delete pkg.dependencies['eslint-plugin-jest']
delete pkg.dependencies['eslint-plugin-jsx-a11y']
delete pkg.dependencies['eslint-plugin-react']
delete pkg.dependencies['eslint-plugin-react-hooks']
delete pkg.dependencies['eslint-plugin-testing-library']
delete pkg.dependencies['jest']
delete pkg.dependencies['jest-circus']
delete pkg.dependencies['jest-resolve']
delete pkg.dependencies['jest-watch-typeahead']
context.log('Removed unused dependencies from react-scripts@4.0.3')
}

// react-scripts@5.0.1
if (pkg.name === 'react-scripts' && pkg.version === '5.0.1') {
delete pkg.dependencies['babel-jest']
delete pkg.dependencies['eslint']
delete pkg.dependencies['eslint-config-react-app']
delete pkg.dependencies['jest']
delete pkg.dependencies['jest-resolve']
delete pkg.dependencies['jest-watch-typeahead']
context.log('Removed unused dependencies from react-scripts@5.0.1')
}

return pkg
}

module.exports = {
hooks: {
readPackage,
},
}
2 changes: 1 addition & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@
},
{
"label": "Basic",
"to": "framework/solid/examples/basic-typescript"
"to": "framework/solid/examples/basic"
},
{
"label": "Basic w/ GraphQL-Request",
Expand Down
4 changes: 2 additions & 2 deletions docs/eslint/eslint-plugin-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ Alternatively, add `@tanstack/eslint-plugin-query` to the plugins section, and c
## Rules

- [@tanstack/query/exhaustive-deps](../exhaustive-deps)
- [@tanstack/query/no-rest-destructuring](../exhaustive-deps)
- [@tanstack/query/stable-query-client](../exhaustive-deps)
- [@tanstack/query/no-rest-destructuring](../no-rest-destructuring)
- [@tanstack/query/stable-query-client](../stable-query-client)
8 changes: 4 additions & 4 deletions docs/framework/react/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Feature/Capability Key:
| Infinite Queries |||| 🛑 | 🛑 |
| Bi-directional Infinite Queries || 🔶 | 🔶 | 🛑 | 🛑 |
| Infinite Query Refetching ||| 🛑 | 🛑 | 🛑 |
| Lagged Query Data<sup>1</sup> ||| 🛑 |||
| Lagged Query Data<sup>1</sup> ||| |||
| Selectors || 🛑 ||| N/A |
| Initial Data ||||||
| Scroll Recovery ||||||
Expand All @@ -48,15 +48,15 @@ Feature/Capability Key:
| Offline Mutation Support || 🛑 | 🟡 | 🛑 | 🛑 |
| Prefetching APIs ||||||
| Query Cancellation || 🛑 | 🛑 | 🛑 ||
| Partial Query Matching<sup>3</sup> || 🔶 | 🛑 || N/A |
| Partial Query Matching<sup>3</sup> || 🔶 | || N/A |
| Stale While Revalidate ||||| 🛑 |
| Stale Time Configuration || 🛑<sup>7</sup> | 🛑 || 🛑 |
| Pre-usage Query/Mutation Configuration<sup>4</sup> || 🛑 | 🛑 |||
| Pre-usage Query/Mutation Configuration<sup>4</sup> || 🛑 | |||
| Window Focus Refetching ||| 🛑 || 🛑 |
| Network Status Refetching ||||| 🛑 |
| General Cache Dehydration/Rehydration || 🛑 ||||
| Offline Caching || 🛑 || 🔶 | 🛑 |
| React Suspense ||| 🛑 | 🛑 ||
| React Suspense ||| | 🛑 ||
| Abstracted/Agnostic Core || 🛑 ||| 🛑 |
| Automatic Refetch after Mutation<sup>5</sup> | 🔶 | 🔶 ||||
| Normalized Caching<sup>6</sup> | 🛑 | 🛑 || 🛑 | 🛑 |
Expand Down
4 changes: 2 additions & 2 deletions docs/framework/react/guides/prefetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ This starts fetching `'article-comments'` immediately and flattens the waterfall

[//]: # 'Suspense'

If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the [`usePrefetchQuery`](../reference/usePrefetchQuery) or the [`usePrefetchInfiniteQuery`](../reference/usePrefetchInfiniteQuery) hooks available in the library.
If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the [`usePrefetchQuery`](../../reference/usePrefetchQuery) or the [`usePrefetchInfiniteQuery`](../../reference/usePrefetchInfiniteQuery) hooks available in the library.

You can now use `useSuspenseQuery` in the component that actually needs the data. You _might_ want to wrap this later component in its own `<Suspense>` boundary so the "secondary" query we are prefetching does not block rendering of the "primary" data.

Expand Down Expand Up @@ -378,7 +378,7 @@ Because data fetching in the component tree itself can easily lead to request wa

In this approach, you explicitly declare for each _route_ what data is going to be needed for that component tree, ahead of time. Because Server Rendering has traditionally needed all data to be loaded before rendering starts, this has been the dominating approach for SSR'd apps for a long time. This is still a common approach and you can read more about it in the [Server Rendering & Hydration guide](../ssr).

For now, let's focus on the client side case and look at an example of how you can make this work with [Tanstack Router](https://tanstack.com/router). These examples leave out a lot of setup and boilerplate to stay concise, you can check out a [full React Query example](https://tanstack.com/router/v1/docs/examples/react/with-react-query?file=src%2Fmain.tsx) over in the [Tanstack Router docs](https://tanstack.com/router/v1/docs).
For now, let's focus on the client side case and look at an example of how you can make this work with [Tanstack Router](https://tanstack.com/router). These examples leave out a lot of setup and boilerplate to stay concise, you can check out a [full React Query example](https://tanstack.com/router/v1/docs/framework/react/examples/basic-react-query-file-based) over in the [Tanstack Router docs](https://tanstack.com/router/v1/docs).

When integrating at the router level, you can choose to either _block_ rendering of that route until all data is present, or you can start a prefetch but not await the result. That way, you can start rendering the route as soon as possible. You can also mix these two approaches and await some critical data, but start rendering before all the secondary data has finished loading. In this example, we'll configure an `/article` route to not render until the article data has finished loading, as well as start prefetching comments as soon as possible, but not block rendering the route if comments haven't finished loading yet.

Expand Down
6 changes: 6 additions & 0 deletions docs/framework/vue/community/community-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ There are lots of community projects that build on top of Vue Query and use it t
A library for creating typesafe standardized query keys, useful for cache management in `@tanstack/query`

Link: https://github.com/lukemorales/query-key-factory

## Query Rewind

Time travel and visualize state during development

Link: https://reactqueryrewind.com/
2 changes: 1 addition & 1 deletion docs/reference/QueryClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Its available methods are:
- `defaultOptions?: DefaultOptions`
- Optional
- Define defaults for all queries and mutations using this queryClient.
- You can also define defaults to be used for [hydration](../../framework/react/reference/hydration.md)
- You can also define defaults to be used for [hydration](../../framework/react/reference/hydration)

## `queryClient.fetchQuery`

Expand Down
4 changes: 2 additions & 2 deletions examples/angular/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^17.3.10",
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.2",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
Expand All @@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.2",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
8 changes: 4 additions & 4 deletions examples/angular/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@tanstack/query-example-angular-infinite-query-with-max-pages",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
},
"private": true,
"dependencies": {
"@angular/common": "^17.3.10",
"@angular/compiler": "^17.3.10",
"@angular/core": "^17.3.10",
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.2",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
Expand All @@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.2",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@angular/router": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.2",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
Expand All @@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.2",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@angular/router": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.2",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
Expand All @@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.2",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
18 changes: 3 additions & 15 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,18 @@
"dependencies": {
"@algolia/client-search": "4.23.3",
"@algolia/transporter": "4.23.3",
"@tanstack/react-query": "^5.50.1",
"@tanstack/react-query-devtools": "^5.50.1",
"@tanstack/react-query": "^5.51.1",
"@tanstack/react-query-devtools": "^5.51.1",
"algoliasearch": "4.23.3",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.50.1",
"@tanstack/eslint-plugin-query": "^5.51.1",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "5.3.3",
"vite": "^5.2.11"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
5 changes: 5 additions & 0 deletions examples/react/auto-refetching/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
Loading

0 comments on commit 80d77b5

Please sign in to comment.