Skip to content

Commit a019e39

Browse files
authored
feat!: Update to react-query v4 (#77)
1 parent 415a355 commit a019e39

File tree

11 files changed

+96
-404
lines changed

11 files changed

+96
-404
lines changed

examples/frontend/package-lock.json

Lines changed: 75 additions & 383 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"gen:github": "openapi-codegen gen github"
1010
},
1111
"dependencies": {
12+
"@tanstack/react-query": "^4.0.10",
1213
"react": "^18.0.0",
13-
"react-dom": "^18.0.0",
14-
"react-query": "^3.38.0"
14+
"react-dom": "^18.0.0"
1515
},
1616
"devDependencies": {
1717
"@openapi-codegen/cli": "^1.5.0",

examples/frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from "react";
2-
import { QueryClient, QueryClientProvider } from "react-query";
2+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
33
import { AuthProvider } from "./Auth";
44
import { useSearchUsers } from "./github/githubComponents";
55

examples/frontend/src/Auth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { createContext, useContext, useState } from "react";
2-
import { useQueryClient } from "react-query";
2+
import { useQueryClient } from "@tanstack/react-query";
33

44
const authContext = createContext<{ token: null | string }>({
55
token: null,

examples/frontend/src/github/githubComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @version 1.1.4
55
*/
6-
import * as reactQuery from "react-query";
6+
import * as reactQuery from "@tanstack/react-query";
77
import { useGithubContext, GithubContext } from "./githubContext";
88
import { githubFetch } from "./githubFetcher";
99
import type * as Schemas from "./githubSchemas";

examples/frontend/src/github/githubContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { QueryKey, UseQueryOptions } from "react-query";
1+
import type { QueryKey, UseQueryOptions } from "@tanstack/react-query";
22
import { useToken } from "../Auth";
33
import { QueryOperation } from "./githubComponents";
44

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/typescript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The `{filenamePrefix}Context.ts` can be tweak to inject any props in the generat
5757

5858
```ts
5959
// `PetStoreContext.ts`
60-
import type { QueryKey, UseQueryOptions } from "react-query";
60+
import type { QueryKey, UseQueryOptions } from "@tanstack/react-query";
6161

6262
export type PetStoreContext = {
6363
fetcherOptions: {

plugins/typescript/src/generators/generateReactQueryComponents.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("generateReactQueryComponents", () => {
8989
*
9090
* @version 1.0.0
9191
*/
92-
import * as reactQuery from \\"react-query\\";
92+
import * as reactQuery from \\"@tanstack/react-query\\";
9393
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
9494
import type * as Fetcher from \\"./petstoreFetcher\\";
9595
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -198,7 +198,7 @@ describe("generateReactQueryComponents", () => {
198198
*
199199
* @version 1.0.0
200200
*/
201-
import * as reactQuery from \\"react-query\\";
201+
import * as reactQuery from \\"@tanstack/react-query\\";
202202
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
203203
import type * as Fetcher from \\"./petstoreFetcher\\";
204204
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -320,7 +320,7 @@ describe("generateReactQueryComponents", () => {
320320
*
321321
* @version 1.0.0
322322
*/
323-
import * as reactQuery from \\"react-query\\";
323+
import * as reactQuery from \\"@tanstack/react-query\\";
324324
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
325325
import type * as Fetcher from \\"./petstoreFetcher\\";
326326
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -434,7 +434,7 @@ describe("generateReactQueryComponents", () => {
434434
*
435435
* @version 1.0.0
436436
*/
437-
import * as reactQuery from \\"react-query\\";
437+
import * as reactQuery from \\"@tanstack/react-query\\";
438438
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
439439
import type * as Fetcher from \\"./petstoreFetcher\\";
440440
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -558,7 +558,7 @@ describe("generateReactQueryComponents", () => {
558558
*
559559
* @version 1.0.0
560560
*/
561-
import * as reactQuery from \\"react-query\\";
561+
import * as reactQuery from \\"@tanstack/react-query\\";
562562
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
563563
import type * as Fetcher from \\"./petstoreFetcher\\";
564564
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -689,7 +689,7 @@ describe("generateReactQueryComponents", () => {
689689
*
690690
* @version 1.0.0
691691
*/
692-
import * as reactQuery from \\"react-query\\";
692+
import * as reactQuery from \\"@tanstack/react-query\\";
693693
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
694694
import type * as Fetcher from \\"./petstoreFetcher\\";
695695
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -826,7 +826,7 @@ describe("generateReactQueryComponents", () => {
826826
*
827827
* @version 1.0.0
828828
*/
829-
import * as reactQuery from \\"react-query\\";
829+
import * as reactQuery from \\"@tanstack/react-query\\";
830830
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
831831
import type * as Fetcher from \\"./petstoreFetcher\\";
832832
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -936,7 +936,7 @@ describe("generateReactQueryComponents", () => {
936936
*
937937
* @version 1.0.0
938938
*/
939-
import * as reactQuery from \\"react-query\\";
939+
import * as reactQuery from \\"@tanstack/react-query\\";
940940
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
941941
import type * as Fetcher from \\"./petstoreFetcher\\";
942942
import { petstoreFetch } from \\"./petstoreFetcher\\";
@@ -1045,7 +1045,7 @@ describe("generateReactQueryComponents", () => {
10451045
*
10461046
* @version 1.0.0
10471047
*/
1048-
import * as reactQuery from \\"react-query\\";
1048+
import * as reactQuery from \\"@tanstack/react-query\\";
10491049
import { useContext, Context } from \\"./context\\";
10501050
import type * as Fetcher from \\"./fetcher\\";
10511051
import { fetch } from \\"./fetcher\\";
@@ -1138,7 +1138,7 @@ describe("generateReactQueryComponents", () => {
11381138
*
11391139
* @version 1.0.0
11401140
*/
1141-
import * as reactQuery from \\"react-query\\";
1141+
import * as reactQuery from \\"@tanstack/react-query\\";
11421142
import { usePetstoreContext, PetstoreContext } from \\"./petstoreContext\\";
11431143
import type * as Fetcher from \\"./petstoreFetcher\\";
11441144
import { petstoreFetch } from \\"./petstoreFetcher\\";

plugins/typescript/src/generators/generateReactQueryComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,6 @@ const createReactQueryImport = () =>
625625
undefined,
626626
f.createNamespaceImport(f.createIdentifier("reactQuery"))
627627
),
628-
f.createStringLiteral("react-query"),
628+
f.createStringLiteral("@tanstack/react-query"),
629629
undefined
630630
);

0 commit comments

Comments
 (0)