Skip to content

Commit ac342e2

Browse files
tannerlinsleyboschnicseasjpangelleJakeGinnivan
authored
v3 (#1360)
* feat: initial v3 changes (#1079) * force website deploy * docs: v3 updates * docs: More documentation improvements * docs: update query filters page * docs: update query keys * docs: more updates * docs: updates * feat: support multiple subscribers in observers * docs: useMutation updates * fix: mutate argument types and state update order * fix: remove cache argument in cache callback * fix: move optimistic fetching state into query observer * fix: make sure default options can be overridden * fix: type improvements * feat: memoize select function result * fix: only suspend when mounting * docs: refactor to top level pages and multiple api reference pages per export * test: add remove query test * feat: add filters client isFetching and useIsFetching hook * docs: temp move docs back to docs directory * docs: solve conflicts * docs: fix queryClient reference * docs: reorg directory structure * docs: fix queryClient reference * docs: fix links * docs: better phrasing * docs: force docs build * docs: update examples * fix: use updatedAt to check for existing data * feat: add structural sharing to select result * refactor: update hashing terminology * test: add ability to wrap react query updates with React act * refactor: replace console with logger implementation * docs: add migration page to navigation * docs: update installation docs * refactor: reduce file size * docs: update examples * fix: always compare query keys as arrays * refactor: mark observers as private * test: update timings in hydration cache time test * docs: Update queries.md (#1134) * feat: split mutate into mutate and mutateAsync (#1130) * feat: split mutate into mutate and mutateAsync * docs: Update docs/src/pages/guides/mutations.md Co-authored-by: Tanner Linsley <[email protected]> * feat: add bi-directional infinite query support (#1135) * refactor: reduce file size * feat: revert to previous state on cancellation * fix: wait for all queries to cancel * docs: update cancellation docs * build: force * build: add beta build * build: add beta build * docs: update comparison * fix: support infinite cache time when hydrating * refactor: explicitly mark package side effects * docs: update comparison * docs: update comparison * fix: remove excess exports * feat: add support for default options when hydrating * docs: fix links * feat: add options to setQueryData * fix: align notify terminology * feat: Major semver bump BREAKING CHANGE: Increment Major Version * fix: always try to fetch if enabled * feat: bump version * fix: refetch should create new query when removed * chore: do not publish beta until we figure this out * make beta prerelease * dry run releases * fix: test dry run semantic release * release beta releases for realzies * test: add eslint rule * docs(useQuery): change manual to enabled (#1167) * feat: move mutations into the core (#1162) * feat: tree shake infinite query and support manual updates * docs: update comparison * refactor: remove observer factory * refactor: add subscribable * refactor: move hasListeners * refactor: optimize bundle * fix: add status bools to use mutation result * feat: api update * fix: add defaults to UseMutationOptions type * docs: add pages * fix: cleanup * refactor: use queryCache property directly * docs: Add placeholder data guide * docs: fix typo * fix: keep previous query status when fetching * fix: stop retry when observers unmount * feat: add additional notify flags * fix: only keep notify on stale option * refactor: only batch react callbacks * test: update timings * refactor: also batch in suspense * feat: add hydration support for mutations * fix: remove query immediately if cacheTime is 0 * fix: prevent infinite fetch loop * refactor: move refetch logic into observer * fix: match query key correctly when setting defaults * test: add query defaults test * fix: re-add useMutation callback composition * feat: use set defaults also for observers * test: add enabled assertion * feat: add ability to manually control the online and focus state * docs: update onlineManager documentation * feat: add discriminated unions for query results (#1247) * fix: only set state in listeners when provided * docs: add testing page * feat: add query function context (#1261) * feat: add errorUpdatedAt property * fix: only trigger suspense when loading for the first time * fix: make sure suspense is always triggered when loading a query * fix: add ability to type the query key in the query function context * refactor: make isDataEqual type more specific * docs: update react native focus code * fix: make sure to remove the correct query from cache * test: remove only * feat: add granular component re-render control * fix: make sure component re-render when they should * feat: throw error when QueryClientProvider has not been used to set a query client (#1309) Also updated docs * test: add invalidateQueries test * fix: prevent state update after mutation unmounted * fix: add defaults to setQueryData * fix: cancellations for useInfiniteQuery (#1359) * chore: update TypeScript version (#1314) * Merge branch 'master' into beta * fix(hydration): set fetchMeta to null by default to make it serializable (#1371) * fix(hasPageParam): look for (undefined | null | false) values * chore: fix linting * fix: cross-bundle/version query client context * docs: Update Examples * docs: update example deps * docs: keepPreviousData not set in paginated queries docs (#1376) * docs: typo infinite instead of ininite (#1379) * feat: devtools are now native to the core repo/npm-package * feat(persist-localstorage-experimental): temporarily persist cache to disk * tests: fix linting * chore: attempt codesandbox import fix * chore: revert codesandbox fix * fix(persist-localstorage): add ssr-safety * docs: fix typos in migration and queries guide (#1387) Fix typos in guides/migrating-to-react-query-3 and guides/queries. Fixes #1378 * docs(typos): fix typos in mutations guide (#1392) * docs: update migration guide * docs: update comparison * chore: remove vercel.json * docs: update comparison * Update logo.sketch * feat: reset query utils (#1375) * feat: reset query utils * Update queryClient.ts * Reset query docs and tests (#1393) * docs: Add resetQueries * test: Add resetQueries tests * remove unnecessary queryCache.reset methods Co-authored-by: Aaron Jensen <[email protected]> * types: fix mutation context type * fix: isFetched and isFetchedAfterMount should include failed fetches * docs: Persist localstorage plugin * feat: resetQueries refetches active queries (#1397) Co-authored-by: Niek Bosch <[email protected]> Co-authored-by: Abhijeet Singh <[email protected]> Co-authored-by: JP Angelle <[email protected]> Co-authored-by: Jake Ginnivan <[email protected]> Co-authored-by: Tom Klaver <[email protected]> Co-authored-by: Dmitry Ivanov <[email protected]> Co-authored-by: Corentin Leruth <[email protected]> Co-authored-by: ConneXNL <[email protected]> Co-authored-by: Rubén Moya <[email protected]> Co-authored-by: Pascal Wegner <[email protected]> Co-authored-by: Amen SOUISSI <[email protected]> Co-authored-by: Aaron Jensen <[email protected]>
1 parent 8aeb209 commit ac342e2

File tree

280 files changed

+15846
-10858
lines changed

Some content is hidden

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

280 files changed

+15846
-10858
lines changed

.eslintrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"parser": "@typescript-eslint/parser",
3-
"plugins": ["@typescript-eslint"],
3+
"plugins": ["@typescript-eslint", "import"],
44
"extends": [
55
"plugin:@typescript-eslint/eslint-recommended",
66
"plugin:@typescript-eslint/recommended",
7+
"plugin:import/typescript",
78
"react-app",
89
"prettier"
910
],
@@ -26,6 +27,10 @@
2627
"ignoreParameters": true
2728
}
2829
],
29-
"no-shadow": "error"
30+
"no-shadow": "error",
31+
"import/no-cycle": "error",
32+
"import/no-unresolved": "error",
33+
"import/no-unused-modules": ["off", { "unusedExports": true }],
34+
"no-redeclare": "off"
3035
}
3136
}

.github/workflows/test-and-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- 'master'
7-
- 'next'
7+
- 'beta'
88
- '1.x'
99
pull_request:
1010

@@ -38,7 +38,7 @@ jobs:
3838
registry-url: https://registry.npmjs.org/
3939
- name: Install dependencies
4040
uses: bahmutov/npm-install@v1
41-
- run: yarn build && yarn build:types
41+
- run: yarn build
4242
- run: npx semantic-release@17
4343
env:
4444
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
node_modules
66

77
# builds
8+
types
89
build
910
dist
1011
lib
1112
es
1213
artifacts
1314
.rpt2_cache
1415
coverage
16+
*.tgz
1517

1618
# misc
1719
.DS_Store
@@ -31,5 +33,3 @@ stats-hydration.json
3133
stats-react.json
3234
stats.html
3335
.vscode/settings.json
34-
35-
types

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Tabl
3939
- Load-More + Infinite Scroll Queries w/ Scroll Recovery
4040
- Request Cancellation
4141
- [React Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html) + Fetch-As-You-Render Query Prefetching
42-
- [Dedicated Devtools (React Query Devtools)](https://github.com/tannerlinsley/react-query-devtools)
42+
- [Dedicated Devtools
4343
- <a href="https://bundlephobia.com/result?p=react-query@latest" target="\_parent">
4444
<img alt="" src="https://badgen.net/bundlephobia/minzip/react-query@latest" />
4545
</a> (depending on features imported)
@@ -80,4 +80,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
8080

8181
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
8282

83-
<!-- Force 1 -->
83+
<!-- Force 2 -->

core/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"internal": true,
3+
"main": "../lib/core/index.js",
4+
"module": "../es/core/index.js",
5+
"types": "../types/core/index.d.ts"
6+
}

devtools/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"internal": true,
3+
"main": "../lib/devtools/index.js",
4+
"module": "../es/devtools/index.js",
5+
"types": "../types/devtools/index.d.ts"
6+
}

docs/next.config.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,21 @@ const remarkPlugins = [
3737
module.exports = optimizedImages({
3838
pageExtensions: ['jsx', 'js', 'mdx', 'md'],
3939
env: {
40-
GA_TRACKING_ID: process.env.GA_TRACKING_ID || '',
40+
NEXT_PUBLIC_GA_TRACKING_ID: process.env.GA_TRACKING_ID || '',
4141
SENTRY_RELEASE: process.env.VERCEL_GITHUB_COMMIT_SHA || '',
4242
},
43+
async redirects() {
44+
return [
45+
{
46+
source: '/docs/:any*',
47+
destination: '/:any*', // Matched parameters can be used in the destination
48+
permanent: true,
49+
},
50+
]
51+
},
4352
experimental: {
4453
plugins: true,
4554
modern: true,
46-
rewrites() {
47-
return [
48-
{
49-
source: '/feed.xml',
50-
destination: '/_next/static/feed.xml',
51-
},
52-
{
53-
source: '/docs{/}?',
54-
destination: '/docs/overview',
55-
},
56-
{
57-
source: '/docs/tag/:tag{/}?',
58-
destination: '/docs/tag/:tag/overview',
59-
},
60-
]
61-
},
6255
},
6356
webpack: (config, { dev, isServer, ...options }) => {
6457
config.module.rules.push({

docs/package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,39 @@
1313
"dependencies": {
1414
"@babel/preset-typescript": "^7.10.4",
1515
"@docsearch/react": "1.0.0-alpha.14",
16-
"@mdx-js/loader": "^1.5.1",
17-
"@mdx-js/mdx": "^1.5.1",
18-
"@mdx-js/react": "^1.5.1",
16+
"@mdx-js/loader": "^1.6.18",
17+
"@mdx-js/mdx": "^1.6.18",
18+
"@mdx-js/react": "^1.6.18",
1919
"@mdx-js/tag": "^0.20.3",
20-
"@next/mdx": "^9.4.0",
21-
"@next/plugin-google-analytics": "^9.4.4",
20+
"@next/mdx": "^9.5.3",
21+
"@next/plugin-google-analytics": "^9.5.3",
2222
"@reactions/component": "^2.0.2",
2323
"@zeit/fetch": "^6.0.0",
2424
"@zeit/react-jsx-parser": "^2.0.0",
2525
"async-sema": "^3.1.0",
26-
"body-scroll-lock": "^3.0.1",
26+
"body-scroll-lock": "^3.1.5",
2727
"classnames": "^2.2.6",
2828
"copy-to-clipboard": "^3.3.1",
29-
"date-fns": "^2.12.0",
29+
"date-fns": "^2.16.1",
3030
"docsearch.js": "^2.6.3",
3131
"framer-motion": "^1.11.1",
3232
"gray-matter": "^4.0.2",
3333
"imagemin-mozjpeg": "^9.0.0",
3434
"imagemin-optipng": "^8.0.0",
3535
"intersection-observer": "^0.10.0",
3636
"isomorphic-unfetch": "^3.0.0",
37-
"next": "^9.4.4",
38-
"next-images": "^1.4.0",
39-
"next-optimized-images": "^2.6.1",
40-
"node-fetch": "^2.6.0",
41-
"prismjs": "^1.20.0",
37+
"next": "^9.5.3",
38+
"next-images": "^1.5.0",
39+
"next-optimized-images": "^2.6.2",
40+
"node-fetch": "^2.6.1",
41+
"prismjs": "^1.21.0",
4242
"react": "^16.13.1",
4343
"react-dom": "^16.13.1",
44-
"react-icons": "^3.9.0",
44+
"react-icons": "^3.11.0",
4545
"react-live": "^2.2.2",
4646
"rehype-format": "^3.0.1",
4747
"rehype-stringify": "^7.0.0",
48-
"remark": "^12.0.0",
48+
"remark": "^12.0.1",
4949
"remark-autolink-headings": "^6.0.0",
5050
"remark-emoji": "^2.1.0",
5151
"remark-footnotes": "^1.0.0",
@@ -54,26 +54,26 @@
5454
"remark-slug": "^6.0.0",
5555
"remark-toc": "^7.0.0",
5656
"remark-unwrap-images": "^2.0.0",
57-
"scroll-into-view-if-needed": "^2.2.24",
57+
"scroll-into-view-if-needed": "^2.2.26",
5858
"semver-regex": "^3.1.1",
59-
"unist-util-visit": "^2.0.2"
59+
"unist-util-visit": "^2.0.3"
6060
},
6161
"devDependencies": {
62-
"@babel/cli": "^7.10.4",
63-
"@babel/core": "^7.10.4",
64-
"@babel/plugin-transform-typescript": "^7.10.4",
62+
"@babel/cli": "^7.11.6",
63+
"@babel/core": "^7.11.6",
64+
"@babel/plugin-transform-typescript": "^7.11.0",
6565
"@babel/preset-react": "^7.10.4",
6666
"@tailwindcss/ui": "^0.3.0",
6767
"algoliasearch": "3.35.1",
6868
"babel-preset-react-app": "^9.1.2",
6969
"dotenv-load": "^2.0.0",
7070
"github-slugger": "^1.3.0",
71-
"md5": "^2.2.1",
71+
"md5": "^2.3.0",
7272
"mdast-util-to-string": "^1.1.0",
7373
"postcss-preset-env": "^6.7.0",
74-
"remark-parse": "^8.0.2",
75-
"tailwindcss": "^1.4.6",
76-
"unified": "^9.0.0",
74+
"remark-parse": "^8.0.3",
75+
"tailwindcss": "^1.8.10",
76+
"unified": "^9.2.0",
7777
"webp-loader": "^0.6.0"
7878
},
7979
"engines": {

docs/src/components/DocsPageFooter.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ function areEqual(prevProps, props) {
1010
}
1111

1212
export const DocsPageFooter = React.memo(({ route, prevRoute, nextRoute }) => {
13-
const editUrl = `${siteConfig.editUrl}${route?.editUrl || route?.path}`
13+
const editUrl =
14+
route?.editUrl || route?.path
15+
? `${siteConfig.editUrl}${route?.editUrl || route?.path}`
16+
: null
1417

1518
return (
1619
<>
@@ -45,16 +48,18 @@ export const DocsPageFooter = React.memo(({ route, prevRoute, nextRoute }) => {
4548
</div>
4649
</div>
4750

48-
<div className="mb-8">
49-
<a
50-
href={editUrl}
51-
target="_blank"
52-
rel="noopener noreferrer"
53-
className="text-gray-600 underline"
54-
>
55-
Edit this page on GitHub
56-
</a>
57-
</div>
51+
{editUrl ? (
52+
<div className="mb-8">
53+
<a
54+
href={editUrl}
55+
target="_blank"
56+
rel="noopener noreferrer"
57+
className="text-gray-600 underline"
58+
>
59+
Edit this page on GitHub
60+
</a>
61+
</div>
62+
) : null}
5863

5964
<div className="py-8 md:flex md:items-center md:py-8 border-t border-b">
6065
<div className="font-semibold text-xl mr-4 text-center mb-4 md:mb-0 md:text-left">

docs/src/components/Footer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ export const Footer = props => {
1313
</h4>
1414
<ul className="mt-4">
1515
<li>
16-
<Link href="/docs/overview">
16+
<Link href="/overview">
1717
<a className="text-base leading-6 text-gray-500 hover:text-gray-900">
1818
Docs
1919
</a>
2020
</Link>
2121
</li>
2222
<li className="mt-4">
23-
<Link href="/docs/examples/simple">
23+
<Link href="/examples/simple">
2424
<a className="text-base leading-6 text-gray-500 hover:text-gray-900">
2525
Examples
2626
</a>
2727
</Link>
2828
</li>
2929
<li className="mt-4">
30-
<Link href="/docs/api">
30+
<Link href="/api/useQuery">
3131
<a className="text-base leading-6 text-gray-500 hover:text-gray-900">
3232
API Reference
3333
</a>

0 commit comments

Comments
 (0)