Skip to content

Commit 8a722d6

Browse files
authored
Merge branch 'alpha' into feature/5054
2 parents 0c7b407 + 153ce78 commit 8a722d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+287
-217
lines changed

.github/workflows/ci-v3.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- 'v3'
77
env:
88
NX_DAEMON: false
9-
NX_VERBOSE_LOGGING: true
109
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1110
jobs:
1211
test:

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
- 'beta'
1616
env:
1717
NX_DAEMON: false
18-
NX_VERBOSE_LOGGING: true
1918
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
2019
jobs:
2120
test-and-publish:
@@ -31,7 +30,7 @@ jobs:
3130
version: 7
3231
- uses: actions/setup-node@v3
3332
with:
34-
node-version: 16.19.0
33+
node-version: 18.16.0
3534
registry-url: https://registry.npmjs.org/
3635
cache: 'pnpm'
3736
- name: Install dependencies

.github/workflows/pr.yml

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ name: pr
22
on: [pull_request]
33
env:
44
NX_DAEMON: false
5-
NX_VERBOSE_LOGGING: true
65
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
76
jobs:
8-
test:
9-
name: 'Test'
7+
agent:
8+
name: 'Nx Cloud Agents'
109
runs-on: ubuntu-latest
10+
timeout-minutes: 20
11+
strategy:
12+
matrix:
13+
agent: [1, 2, 3, 4]
1114
steps:
1215
- uses: actions/checkout@v3
1316
with:
@@ -19,20 +22,14 @@ jobs:
1922
version: 7
2023
- uses: actions/setup-node@v3
2124
with:
22-
node-version: 16.19.0
25+
node-version: 18.16.0
2326
cache: 'pnpm'
2427
- name: Install dependencies
2528
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
26-
- name: Run Tests
27-
uses: nick-fields/[email protected]
28-
with:
29-
command: pnpm test:lib --base=${{ github.event.pull_request.base.sha }}
30-
timeout_minutes: 5
31-
max_attempts: 3
32-
- name: Upload coverage to Codecov
33-
uses: codecov/codecov-action@v3
34-
lint:
35-
name: 'Lint'
29+
- name: Start Nx Agent ${{ matrix.agent }}
30+
run: npx nx-cloud start-agent
31+
orchestrator:
32+
name: 'Nx Cloud Orchestrator'
3633
runs-on: ubuntu-latest
3734
steps:
3835
- uses: actions/checkout@v3
@@ -45,30 +42,29 @@ jobs:
4542
version: 7
4643
- uses: actions/setup-node@v3
4744
with:
48-
node-version: 16.14.2
45+
node-version: 18.16.0
4946
cache: 'pnpm'
5047
- name: Install dependencies
5148
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
52-
- run: pnpm run test:eslint --base=${{ github.event.pull_request.base.sha }}
53-
typecheck:
54-
name: 'Typecheck'
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v3
58-
with:
59-
fetch-depth: 0
60-
ref: ${{ github.head_ref }}
61-
repository: ${{github.event.pull_request.head.repo.full_name}}
62-
- uses: pnpm/[email protected]
63-
with:
64-
version: 7
65-
- uses: actions/setup-node@v3
49+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
50+
uses: nrwl/nx-set-shas@v2
51+
- run: |
52+
echo "BASE: ${{ env.NX_BASE }}"
53+
echo "HEAD: ${{ env.NX_HEAD }}"
54+
- name: Start CI Orchestrator
55+
run: npx nx-cloud start-ci-run
56+
- name: Run All Checks
57+
uses: nick-fields/[email protected]
58+
env:
59+
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
6660
with:
67-
node-version: 16.14.2
68-
cache: 'pnpm'
69-
- name: Install dependencies
70-
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
71-
- run: pnpm run test:types --base=${{ github.event.pull_request.base.sha }}
61+
timeout_minutes: 5
62+
max_attempts: 3
63+
command: npx nx affected --targets=test:eslint,test:types,test:build,test:lib --base=${{ github.event.pull_request.base.sha }}
64+
- name: Stop Agents
65+
run: npx nx-cloud stop-all-agents
66+
- name: Upload coverage to Codecov
67+
uses: codecov/codecov-action@v3
7268
format:
7369
name: 'Format'
7470
runs-on: ubuntu-latest
@@ -83,25 +79,8 @@ jobs:
8379
version: 7
8480
- uses: actions/setup-node@v3
8581
with:
86-
node-version: 16.14.2
82+
node-version: 18.16.0
8783
cache: 'pnpm'
8884
- name: Install dependencies
8985
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
9086
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
91-
test-build:
92-
name: 'Test Build'
93-
runs-on: ubuntu-latest
94-
steps:
95-
- uses: actions/checkout@v3
96-
- uses: pnpm/[email protected]
97-
with:
98-
version: 7
99-
- uses: actions/setup-node@v3
100-
with:
101-
node-version: 16.14.2
102-
cache: 'pnpm'
103-
- name: Install dependencies
104-
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
105-
- run: pnpm run test:build
106-
env:
107-
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.19.0
1+
v18.16.0

docs/react/guides/migrating-to-v5.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ If you want to run it against `.js` or `.jsx` files, please use the command belo
108108
```
109109
npx jscodeshift ./path/to/src/ \
110110
--extensions=js,jsx \
111-
--transform=./node_modules/@tanstack/react-query/codemods/v5/remove-overloads/remove-overloads.js
111+
--transform=./node_modules/@tanstack/react-query/build/codemods/v5/remove-overloads/remove-overloads.js
112112
```
113113

114114
If you want to run it against `.ts` or `.tsx` files, please use the command below:
@@ -117,7 +117,7 @@ If you want to run it against `.ts` or `.tsx` files, please use the command belo
117117
npx jscodeshift ./path/to/src/ \
118118
--extensions=ts,tsx \
119119
--parser=tsx \
120-
--transform=./node_modules/@tanstack/react-query/codemods/v5/remove-overloads/remove-overloads.js
120+
--transform=./node_modules/@tanstack/react-query/build/codemods/v5/remove-overloads/remove-overloads.js
121121
```
122122

123123
Please note in the case of `TypeScript` you need to use `tsx` as the parser; otherwise, the codemod won't be applied properly!
@@ -202,9 +202,9 @@ const queryClient = new QueryClient({
202202
})
203203
```
204204

205-
### The `useErrorBoundary` option has been renamed to `throwErrors`
205+
### The `useErrorBoundary` option has been renamed to `throwOnError`
206206

207-
To make the `useErrorBoundary` option more framework-agnostic and avoid confusion with the established React function prefix "`use`" for hooks and the "ErrorBoundary" component name, it has been renamed to `throwErrors` to more accurately reflect its functionality.
207+
To make the `useErrorBoundary` option more framework-agnostic and avoid confusion with the established React function prefix "`use`" for hooks and the "ErrorBoundary" component name, it has been renamed to `throwOnError` to more accurately reflect its functionality.
208208

209209
### TypeScript: `Error` is now the default type for errors instead of `unknown`
210210

@@ -439,16 +439,8 @@ You can adjust the `maxPages` value according to the UX and refetching performan
439439

440440
Note that the infinite list must be bi-directional, which requires both `getNextPageParam` and `getPreviousPageParam` to be defined.
441441

442-
### CreateStore
442+
### Typesafe way to create Query Options
443443

444-
We are now exposing a way to customize how queries are stored internally. Per default, a `Map` is used but, with the new `createStore` function, you can now use any data structure you want.
445-
446-
```ts
447-
const queryClient = new QueryClient({
448-
queryCache: new QueryCache({
449-
createStore: () => new Map()
450-
}),
451-
})
452-
```
444+
See the [Typescript Docs](../typescript#typing-query-options) for more details.
453445

454446
[//]: # 'NewFeatures'

docs/react/guides/suspense.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ useQuery({ queryKey, queryFn, suspense: true })
4141

4242
When using suspense mode, `status` states and `error` objects are not needed and are then replaced by usage of the `React.Suspense` component (including the use of the `fallback` prop and React error boundaries for catching errors). Please read the [Resetting Error Boundaries](#resetting-error-boundaries) and look at the [Suspense Example](https://codesandbox.io/s/github/tannerlinsley/react-query/tree/main/examples/react/suspense) for more information on how to set up suspense mode.
4343

44-
In addition to queries behaving differently in suspense mode, mutations also behave a bit differently. By default, instead of supplying the `error` variable when a mutation fails, it will be thrown during the next render of the component it's used in and propagate to the nearest error boundary, similar to query errors. If you wish to disable this, you can set the `throwErrors` option to `false`. If you wish that errors are not thrown at all, you can set the `throwOnError` option to `false` as well!
44+
In addition to queries behaving differently in suspense mode, mutations also behave a bit differently. By default, instead of supplying the `error` variable when a mutation fails, it will be thrown during the next render of the component it's used in and propagate to the nearest error boundary, similar to query errors. If you wish to disable this, you can set the `throwOnError` option to `false`. If you wish that errors are not thrown at all, you can set the `throwOnError` option to `false` as well!
4545

4646
## Resetting Error Boundaries
4747

48-
Whether you are using **suspense** or **throwErrors** in your queries, you will need a way to let queries know that you want to try again when re-rendering after some error occurred.
48+
Whether you are using **suspense** or **throwOnError** in your queries, you will need a way to let queries know that you want to try again when re-rendering after some error occurred.
4949

5050
Query errors can be reset with the `QueryErrorResetBoundary` component or with the `useQueryErrorResetBoundary` hook.
5151

docs/react/plugins/createSyncStoragePersister.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ import { compress, decompress } from 'lz-string';
128128
const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity } } });
129129

130130
persistQueryClient({
131-
queryClient: connectionsQueryClient,
132-
persistor: createSyncStoragePersister({
131+
queryClient: queryClient,
132+
persister: createSyncStoragePersister({
133133
storage: window.localStorage,
134134
serialize: data => compress(JSON.stringify(data)),
135135
deserialize: data => JSON.parse(decompress(data)),

docs/react/reference/QueryCache.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ Its available methods are:
4343
- `onSettled?:` (data: unknown | undefined, error: unknown | null, query: Query) => void
4444
- Optional
4545
- This function will be called if some query is settled (either successful or errored).
46-
- `createStore?: () => QueryStore`
47-
- Optional
48-
- This function will be called to create the store that will be used to store the queries. By default, a `Map` is used.
4946

5047
## Global callbacks
5148

docs/react/reference/QueryClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ try {
9191

9292
**Options**
9393

94-
The options for `fetchQuery` are exactly the same as those of [`useQuery`](../reference/useQuery), except the following: `enabled, refetchInterval, refetchIntervalInBackground, refetchOnWindowFocus, refetchOnReconnect, notifyOnChangeProps, onSuccess, onError, onSettled, throwErrors, select, suspense, placeholderData`; which are strictly for useQuery and useInfiniteQuery. You can check the [source code](https://github.com/tannerlinsley/react-query/blob/361935a12cec6f36d0bd6ba12e84136c405047c5/src/core/types.ts#L83) for more clarity.
94+
The options for `fetchQuery` are exactly the same as those of [`useQuery`](../reference/useQuery), except the following: `enabled, refetchInterval, refetchIntervalInBackground, refetchOnWindowFocus, refetchOnReconnect, refetchOnMount, notifyOnChangeProps, throwOnError, select, suspense, placeholderData`; which are strictly for useQuery and useInfiniteQuery. You can check the [source code](https://github.com/TanStack/query/blob/7cd2d192e6da3df0b08e334ea1cf04cd70478827/packages/query-core/src/types.ts#L119) for more clarity.
9595

9696
**Returns**
9797

docs/react/reference/QueryErrorResetBoundary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: QueryErrorResetBoundary
33
title: QueryErrorResetBoundary
44
---
55

6-
When using **suspense** or **throwErrors** in your queries, you need a way to let queries know that you want to try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can reset any query errors within the boundaries of the component.
6+
When using **suspense** or **throwOnError** in your queries, you need a way to let queries know that you want to try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can reset any query errors within the boundaries of the component.
77

88
```tsx
99
import { QueryErrorResetBoundary } from '@tanstack/react-query'

0 commit comments

Comments
 (0)