Skip to content

Commit b65c0a0

Browse files
committed
Merge remote-tracking branch 'origin/master' into beta
2 parents bc37266 + f8ec3c1 commit b65c0a0

File tree

27 files changed

+1147
-22
lines changed

27 files changed

+1147
-22
lines changed

docs/src/pages/docs/api.md

Lines changed: 1001 additions & 0 deletions
Large diffs are not rendered by default.

docs/src/pages/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const fans = [
3434
'Kristóf Poduszló (@kripod)',
3535
'Peter Pistorius (@peterp)',
3636
'Agustín Villalobos (@agustin-v)',
37+
'Panigo (@rangigo)',
38+
'Jesse Jafa, (@awareness481)',
3739
]
3840

3941
const Home = () => {

docs/src/pages/reference/useQuery.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
isFetching,
1414
isIdle,
1515
isLoading,
16+
isPlaceholderData,
1617
isPreviousData,
1718
isStale,
1819
isSuccess,
@@ -68,7 +69,7 @@ const result = useQuery({
6869
- Must return a promise that will either resolves data or throws an error.
6970
- `enabled: boolean`
7071
- Set this to `false` to disable this query from automatically running.
71-
- Actually it can be anything that will pass a boolean condition. See [Dependent Queries](./guides/queries#dependent-queries) for more information.
72+
- Can be used for [Dependent Queries](./guides/queries#dependent-queries).
7273
- `retry: boolean | number | (failureCount: number, error: TError) => boolean`
7374
- If `false`, failed queries will not retry by default.
7475
- If `true`, failed queries will retry infinitely.
@@ -128,11 +129,16 @@ const result = useQuery({
128129
- Set this to `true` to enable suspense mode.
129130
- When `true`, `useQuery` will suspend when `status === 'loading'`
130131
- When `true`, `useQuery` will throw runtime errors when `status === 'error'`
131-
- `initialData: unknown | () => unknown`
132+
- `initialData: TData | () => TData`
132133
- Optional
133134
- If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet)
134135
- If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData
135136
- Initial data is considered stale by default unless a `staleTime` has been set.
137+
- `initialData` **is persisted** to the cache
138+
- `placeholderData: TData | () => TData`
139+
- Optional
140+
- If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided.
141+
- `placeholderData` is **not persisted** to the cache
136142
- `keepPreviousData: boolean`
137143
- Optional
138144
- Defaults to `false`
@@ -170,6 +176,8 @@ const result = useQuery({
170176
- The error object for the query, if an error was thrown.
171177
- `isStale: boolean`
172178
- Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
179+
- `isPlaceholderData: boolean`
180+
- Will be `true` if the data shown is the placeholder data.
173181
- `isPreviousData: boolean`
174182
- Will be `true` when `keepPreviousData` is set and data from the previous query is returned.
175183
- `isFetchedAfterMount: boolean`

docs/src/pages/typescript.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ Things to keep in mind:
1111
- Changes to types in this repository are considered **non-breaking** and are usually released as **patch** semver changes (otherwise every type enhancement would be a major version!).
1212
- It is **highly recommended that you lock your react-query package version to a specific patch release and upgrade with the expectation that types may be fixed or upgraded between any release**
1313
- The non-type-related public API of React Query still follows semver very strictly.
14+
15+
## Defining Custom Hooks
16+
17+
When defining a custom hook you need to specify the result and error types, for example:
18+
19+
```js
20+
function useGroups() {
21+
return useQuery<Group[], Error>('groups', fetchGroups)
22+
}
23+
```

examples/basic-graphql-request/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"graphql-request": "^3.1.0",
1313
"react": "^16.8.6",
1414
"react-dom": "^16.8.6",
15-
"react-query": "^2.21.2",
15+
"react-query": "2.23.1",
1616
"react-query-devtools": "^2.4.7",
1717
"react-scripts": "3.0.1",
1818
"stop-runaway-react-effects": "^1.2.0",
@@ -36,4 +36,4 @@
3636
"last 1 safari version"
3737
]
3838
}
39-
}
39+
}
-3.67 KB
Binary file not shown.

examples/basic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"axios": "0.19.2",
1111
"react": "^16.8.6",
1212
"react-dom": "^16.8.6",
13-
"react-query": "^2.21.2",
13+
"react-query": "2.23.1",
1414
"react-query-devtools": "^2.4.7",
1515
"react-scripts": "3.0.1",
1616
"stop-runaway-react-effects": "^1.2.0",
@@ -34,4 +34,4 @@
3434
"last 1 safari version"
3535
]
3636
}
37-
}
37+
}

examples/basic/public/favicon.ico

-3.69 KB
Binary file not shown.

examples/custom-hooks/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"axios": "0.19.2",
1111
"react": "^16.8.6",
1212
"react-dom": "^16.8.6",
13-
"react-query": "^2.21.2",
13+
"react-query": "2.23.1",
1414
"react-query-devtools": "^2.4.7",
1515
"react-scripts": "3.0.1",
1616
"stop-runaway-react-effects": "^1.2.0",
@@ -35,4 +35,4 @@
3535
"last 1 safari version"
3636
]
3737
}
38-
}
38+
}
-3.68 KB
Binary file not shown.

0 commit comments

Comments
 (0)