Skip to content

Commit 47bf076

Browse files
committed
Merge remote-tracking branch 'react-query/master' into alpha
# Conflicts: # src/core/notifyManager.ts # src/core/types.ts
2 parents 1abb371 + c532d81 commit 47bf076

Some content is hidden

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

45 files changed

+12068
-34
lines changed

.all-contributorsrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@
193193
"contributions": [
194194
"code"
195195
]
196+
},
197+
{
198+
"login": "arnaudbzn",
199+
"name": "Arnaud",
200+
"avatar_url": "https://avatars.githubusercontent.com/u/20332397?v=4",
201+
"profile": "http://seaviewlab.com",
202+
"contributions": [
203+
"code",
204+
"doc"
205+
]
196206
}
197207
],
198208
"contributorsPerLine": 7,

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ body:
66
value: |
77
Thank you for reporting an issue :pray:.
88
9-
This issue tracker is for reporting reproducible bugs or regression's found in react-query (https://github.com/tannerlinsley/react-query)
9+
This issue tracker is for reporting reproducible bugs or regression's found in [react-query](https://github.com/tannerlinsley/react-query)
1010
If you have a question about how to achieve something and are struggling, please post a question
11-
inside of react-query's Discussion's tab: https://github.com/tannerlinsley/react-query/discussions
11+
inside of react-query's [Discussions tab](https://github.com/tannerlinsley/react-query/discussions)
1212
1313
Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already:
14-
- react-query's Discussion's tab: https://github.com/tannerlinsley/react-query/discussions
15-
- react-query's Issue's tab: https://github.com/tannerlinsley/react-query/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
16-
- react-query's Closed issues tab: https://github.com/tannerlinsley/react-query/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed
14+
- react-query's [Discussions tab](https://github.com/tannerlinsley/react-query/discussions)
15+
- react-query's [Open Issues](https://github.com/tannerlinsley/react-query/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
16+
- react-query's [Closed Issues](https://github.com/tannerlinsley/react-query/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed)
1717
1818
The more information you fill in, the better the community can help you.
1919
- type: textarea
@@ -26,15 +26,20 @@ body:
2626
- type: input
2727
id: link
2828
attributes:
29-
label: Your Example Website or App
29+
label: Your minimal, reproducible example
3030
description: |
31-
Which website or app were you using when the bug happened?
31+
Please add a link to a minimal reproduction.
3232
Note:
33-
- Your bug will may get fixed much faster if we can run your code and it doesn't have dependencies other than React.
34-
- To create a shareable code example you can use Stackblitz (https://stackblitz.com/) or CodeSandbox (https://codesandbox.io/s/new). Please no localhost URLs.
33+
- Your bug may get fixed much faster if we can run your code and it doesn't have dependencies other than React.
34+
- To create a shareable code example for web, you can use CodeSandbox (https://codesandbox.io/s/new) or Stackblitz (https://stackblitz.com/).
35+
- Please make sure the example is complete and runnable - e.g. avoid localhost URLs.
36+
- To stub out real api requests - Promise.resolve and Promise.reject are good options for easy reproduction
37+
- Feel free to fork any of the official CodeSandbox examples to reproduce your issue: https://react-query.tanstack.com/examples/simple
38+
- For React Native, you can use: https://snack.expo.dev/
39+
- For TypeScript related issues only, a TypeScript Playground link might be sufficient: https://www.typescriptlang.org/play
3540
- Please read these tips for providing a minimal example: https://stackoverflow.com/help/mcve.
3641
placeholder: |
37-
e.g. Stackblitz, Code Sandbox app url
42+
e.g. Code Sandbox, Stackblitz, Expo Snack or TypeScript playground
3843
validations:
3944
required: true
4045
- type: textarea
@@ -82,12 +87,32 @@ body:
8287
id: platform
8388
attributes:
8489
label: Platform
85-
value: |
90+
description: |
91+
Please let us know which Operting System, Browser and Browser version you were using when the issue occurred.
92+
placeholder: |
8693
- OS: [e.g. macOS, Windows, Linux, iOS, Android]
8794
- Browser: [e.g. Chrome, Safari, Firefox, React Native]
8895
- Version: [e.g. 91.1]
8996
validations:
9097
required: true
98+
- type: input
99+
id: rq-version
100+
attributes:
101+
label: react-query version
102+
description: |
103+
Please let us know the exact version of react-query you were using when the issue occurred. Please don't just put in "latest", as this is subject to change.
104+
placeholder: |
105+
e.g. v3.30.1
106+
validations:
107+
required: true
108+
- type: input
109+
id: ts-version
110+
attributes:
111+
label: TypeScript version
112+
description: |
113+
If you are using TypeScript, please let us know the exact version of TypeScript you were using when the issue occurred.
114+
placeholder: |
115+
e.g. v4.5.4
91116
- type: textarea
92117
id: additional
93118
attributes:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
8181
<td align="center"><a href="http://prateeksurana.me"><img src="https://avatars.githubusercontent.com/u/21277179?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Prateek Surana</b></sub></a><br /><a href="https://github.com/tannerlinsley/react-query/commits?author=prateek3255" title="Code">💻</a></td>
8282
<td align="center"><a href="https://github.com/babycourageous"><img src="https://avatars.githubusercontent.com/u/14936212?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rene Dellefont</b></sub></a><br /><a href="https://github.com/tannerlinsley/react-query/commits?author=babycourageous" title="Code">💻</a> <a href="https://github.com/tannerlinsley/react-query/commits?author=babycourageous" title="Documentation">📖</a></td>
8383
<td align="center"><a href="https://github.com/jvuoti"><img src="https://avatars.githubusercontent.com/u/3702781?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Janne Vuoti</b></sub></a><br /><a href="https://github.com/tannerlinsley/react-query/commits?author=jvuoti" title="Code">💻</a></td>
84+
<td align="center"><a href="http://seaviewlab.com"><img src="https://avatars.githubusercontent.com/u/20332397?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arnaud</b></sub></a><br /><a href="https://github.com/tannerlinsley/react-query/commits?author=arnaudbzn" title="Code">💻</a> <a href="https://github.com/tannerlinsley/react-query/commits?author=arnaudbzn" title="Documentation">📖</a></td>
8485
</tr>
8586
</table>
8687

docs/src/manifests/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@
316316
"title": "Next.js",
317317
"path": "/examples/nextjs",
318318
"editUrl": "/examples/nextjs.mdx"
319+
},
320+
{
321+
"title": "React Native",
322+
"path": "/examples/react-native",
323+
"editUrl": "/examples/react-native.mdx"
319324
}
320325
]
321326
},

docs/src/pages/community/tkdodos-blog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ React Query maintainer [TkDodo](https://twitter.com/tkdodo) has a series of blog
5252
5353
## [#12: Mastering Mutations in React Query](https://tkdodo.eu/blog/mastering-mutations-in-react-query)
5454

55-
> Mutation are the important, second part necessary to work with server data - for situations where you need to update it. This blog post covers what mutations are and how they are different from queries. You'll learn the difference between `mutate` and `mutateAsync` as well as how you can tie queries and mutations together. [Read more...](https://tkdodo.eu/blog/mastering-mutations-in-react-query)
55+
> Mutations are the important, second part necessary to work with server data - for situations where you need to update it. This blog post covers what mutations are and how they are different from queries. You'll learn the difference between `mutate` and `mutateAsync` as well as how you can tie queries and mutations together. [Read more...](https://tkdodo.eu/blog/mastering-mutations-in-react-query)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
id: react-native
3+
title: React Native
4+
toc: false
5+
---
6+
7+
- [Open the Snack](https://snack.expo.dev/@arnaudbzn/react-query-basic-example)
8+
- [TypeScript version in the repo](https://github.com/tannerlinsley/react-query/tree/master/examples/react-native)
9+
10+
<iframe
11+
src="https://snack.expo.dev/@arnaudbzn/react-query-basic-example"
12+
title="tannerlinsley/react-query: react native"
13+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
14+
style={{
15+
width: '100%',
16+
height: '80vh',
17+
border: '0',
18+
borderRadius: 8,
19+
overflow: 'hidden',
20+
position: 'static',
21+
zIndex: 0,
22+
}}
23+
></iframe>

docs/src/pages/guides/ssr.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ function Posts() {
107107

108108
As demonstrated, it's fine to prefetch some queries and let others fetch on the queryClient. This means you can control what content server renders or not by adding or removing `prefetchQuery` for a specific query.
109109

110+
### Caveat for Next.js rewrites
111+
112+
There's a catch if you're using [Next.js' rewrites feature](https://nextjs.org/docs/api-reference/next.config.js/rewrites) together with [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization) or `getStaticProps`: It will cause a second hydration by React Query. That's because [Next.js needs to ensure that they parse the rewrites](https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewrite-parameters) on the client and collect any params after hydration so that they can be provided in `router.query`.
113+
114+
The result is missing referential equality for all the hydration data, which for example triggers whereever your data is used as props of components or in the dependency array of `useEffect`s/`useMemo`s.
115+
110116
## Using Other Frameworks or Custom SSR Frameworks
111117

112118
This guide is at-best, a high level overview of how SSR with React Query should work. Your mileage may vary since there are many different possible setups for SSR.

docs/src/pages/reference/useMutation.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const {
2424
onMutate,
2525
onSettled,
2626
onSuccess,
27+
retry,
28+
retryDelay,
2729
useErrorBoundary,
2830
meta
2931
})
@@ -69,7 +71,8 @@ mutate(variables, {
6971
- This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error
7072
- If a promise is returned, it will be awaited and resolved before proceeding
7173
- `retry: boolean | number | (failureCount: number, error: TError) => boolean`
72-
- If `false`, failed mutations will not retry by default.
74+
- Defaults to `0`.
75+
- If `false`, failed mutations will not retry.
7376
- If `true`, failed mutations will retry infinitely.
7477
- If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number.
7578
- `retryDelay: number | (retryAttempt: number, error: TError) => number`

examples/load-more-infinite-scroll/pages/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ function Example() {
6565
onClick={() => fetchPreviousPage()}
6666
disabled={!hasPreviousPage || isFetchingPreviousPage}
6767
>
68-
{isFetchingNextPage
68+
{isFetchingPreviousPage
6969
? 'Loading more...'
70-
: hasNextPage
70+
: hasPreviousPage
7171
? 'Load Older'
7272
: 'Nothing more to load'}
7373
</button>

examples/react-native/.eslintrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"root": true,
3+
"extends": "@callstack",
4+
"rules": {
5+
"react-native/no-raw-text": 0,
6+
"promise/prefer-await-to-then": 0
7+
},
8+
"settings": {
9+
"import/resolver": {
10+
"alias": {
11+
"map": [["@app", "./src"]],
12+
"extensions": [".ts", ".tsx", ".js", ".jsx", ".json"]
13+
}
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)