Skip to content

Commit 3ceb5ff

Browse files
authored
rebranded imports (#3803)
* refactor: apply import codemod to examples * refactor: update import in typescript example * refactor: more import updates * chore: run prettier over examples * chore: try to setup codesandbox-ci for the monorepo structure * chore: force the use of npm ci in the pipeline * chore: install with leagacy peer deps * chore: try --force instead * chore: re-generate lock file in the hopes that it fixes the install problems * chore: force testing-library to v12.1.4 because 12.1.5 only supports react < 18, and we install both 17 and 18 * chore: try again with legacy peer deps now that only eslint-config is failing * chore: try if removing examples from workspaces changes a damn thing * Revert "chore: try if removing examples from workspaces changes a damn thing" This reverts commit c4be184. * chore: try a specific node version * chore: add dependencies to correct packages * chore: add missing dev dependencies (maybe) * chore: add more top level devDependencies * chore: move jscodeshift to the top, too * chore: try with npm install * chore: run node16 only! * chore: run node16 only * chore: remove devDependencies from top level package.json again root cause seems to be sub-packages not being installed with `npm ci`, so we switched to `npm install` instead
1 parent b57e154 commit 3ceb5ff

File tree

43 files changed

+6740
-18922
lines changed

Some content is hidden

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

43 files changed

+6740
-18922
lines changed

.codesandbox/ci.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"installCommand": "install:csb",
33
"sandboxes": ["/examples/react/basic", "/examples/react/basic-typescript"],
4+
"packages": ["packages/**"],
45
"node": "16"
56
}

.github/workflows/pr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node: [14, 16]
9+
node: [16.14.2]
1010
react: [17, 18]
1111
steps:
1212
- uses: actions/checkout@v2
@@ -15,11 +15,13 @@ jobs:
1515
node-version: ${{ matrix.node }}
1616
- name: Install dependencies
1717
uses: bahmutov/npm-install@v1
18+
with:
19+
install-command: npm install
1820
- run: npm run test:ci
1921
env:
2022
REACTJS_VERSION: ${{ matrix.react }}
2123
- run: npm run test:size
22-
if: matrix.node == '16' && matrix.react == '18'
24+
if: matrix.react == '18'
2325
env:
2426
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
2527
- name: Upload coverage to Codecov

.nvmrc

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

docs/plugins/createAsyncStoragePersister.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ This utility comes packaged with `react-query` and is available under the `react
1616

1717
```ts
1818
import AsyncStorage from '@react-native-async-storage/async-storage'
19-
import { persistQueryClient } from 'react-query/persistQueryClient'
20-
import { createAsyncStoragePersister } from 'react-query/createAsyncStoragePersister'
19+
import { persistQueryClient } from '@tanstack/react-query-persist-client'
20+
import { createSyncStoragePersister } from '@tanstack/query-async-storage-persister'
2121

2222
const queryClient = new QueryClient({
2323
defaultOptions: {

docs/plugins/createSyncStoragePersister.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type PersistRetryer = (props: {
5050
5151
### Predefined strategies
5252
53-
Per default, no retry will occur. You can use one of the predefined strategies to handle retries. They can be imported `from 'react-query/persistQueryClient'`:
53+
Per default, no retry will occur. You can use one of the predefined strategies to handle retries. They can be imported `from '@tanstack/react-query-persist-client'`:
5454
5555
- `removeOldestQuery`
5656
- will return a new `PersistedClient` with the oldest query removed.

docs/plugins/persistQueryClient.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,15 @@ export interface PersistedClient {
247247

248248
You can import these (to build a persister):
249249
```ts
250-
import { PersistedClient, Persister } from "react-query/persistQueryClient";
250+
import { PersistedClient, Persister } from "@tanstack/react-query-persist-client";
251251
```
252252

253253
### Building A Persister
254254
You can persist however you like. Here is an example of how to build an [Indexed DB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) persister. Compared to `Web Storage API`, Indexed DB is faster, stores more than 5MB, and doesn't require serialization. That means it can readily store Javascript native types, such as `Date` and `File`.
255255

256256
```ts
257257
import { get, set, del } from "idb-keyval";
258-
import { PersistedClient, Persister } from "react-query/persistQueryClient";
258+
import { PersistedClient, Persister } from "@tanstack/react-query-persist-client";
259259

260260
/**
261261
* Creates an Indexed DB persister

examples/react/auto-refetching/pages/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
useMutation,
1010
QueryClient,
1111
QueryClientProvider,
12-
} from '@tanstack/react-query'
13-
import { ReactQueryDevtools } from 'react-query/devtools'
12+
} from "@tanstack/react-query"
13+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
1414

1515
const queryClient = new QueryClient()
1616

examples/react/basic-graphql-request/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
useQueryClient,
77
QueryClient,
88
QueryClientProvider,
9-
} from "react-query";
10-
import { ReactQueryDevtools } from "react-query/devtools";
9+
} from "@tanstack/react-query";
10+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
1111
import { request, gql } from "graphql-request";
1212

1313
const endpoint = "https://graphqlzero.almansi.me/api";

examples/react/basic-typescript/src/index.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import * as React from "react";
33
import ReactDOM from "react-dom/client";
44
import axios from "axios";
5-
import { useQuery, useQueryClient, QueryClient } from "react-query";
6-
import { PersistQueryClientProvider } from "react-query/persistQueryClient";
7-
import { createWebStoragePersister } from "react-query/createWebStoragePersister";
8-
import { ReactQueryDevtools } from "react-query/devtools";
5+
import { useQuery, useQueryClient, QueryClient } from "@tanstack/react-query";
6+
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
7+
import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
8+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
99

1010
const queryClient = new QueryClient({
1111
defaultOptions: {
@@ -15,7 +15,7 @@ const queryClient = new QueryClient({
1515
},
1616
});
1717

18-
const persister = createWebStoragePersister({
18+
const persister = createSyncStoragePersister({
1919
storage: window.localStorage,
2020
});
2121

@@ -26,15 +26,12 @@ type Post = {
2626
};
2727

2828
function usePosts() {
29-
return useQuery(
30-
["posts"],
31-
async (): Promise<Array<Post>> => {
32-
const { data } = await axios.get(
33-
"https://jsonplaceholder.typicode.com/posts"
34-
);
35-
return data;
36-
}
37-
);
29+
return useQuery(["posts"], async (): Promise<Array<Post>> => {
30+
const { data } = await axios.get(
31+
"https://jsonplaceholder.typicode.com/posts"
32+
);
33+
return data;
34+
});
3835
}
3936

4037
function Posts({

examples/react/basic/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
useQueryClient,
88
QueryClient,
99
QueryClientProvider,
10-
} from "react-query";
11-
import { ReactQueryDevtools } from "react-query/devtools";
10+
} from "@tanstack/react-query";
11+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
1212

1313
const queryClient = new QueryClient();
1414

0 commit comments

Comments
 (0)