Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade react-query to v5, react 18 and yarn v4 #9473

Merged
merged 103 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
dc19387
Upgrade react-query to v5
djhi Nov 21, 2023
825af95
Upgrade dependencies
djhi Nov 21, 2023
fa12ff8
Update ra-ui-materialui
djhi Nov 21, 2023
a320921
Update ra-no-code
djhi Nov 21, 2023
c1a8e65
Upgrade testing-library
djhi Nov 21, 2023
3a60f8c
Update examples
djhi Nov 21, 2023
6059cd8
Update react-test-renderer
djhi Nov 21, 2023
5c49394
Fix useGetOne and useShowController
djhi Nov 21, 2023
929620d
Fix some auth tests
djhi Nov 21, 2023
14e3c50
Fix useAuthState
djhi Nov 21, 2023
c093b90
Fix useListController
djhi Nov 21, 2023
b06d9ea
Fix react-query imports
djhi Nov 21, 2023
ae03d12
Fix useUnique tests
djhi Nov 21, 2023
228c424
Fix useConfigureAdminRouterFromChildren tests
djhi Nov 21, 2023
12b4fb1
Fix useGetList
djhi Nov 22, 2023
399b851
Fix useGetOne
djhi Nov 22, 2023
af0d038
Fix useInfiniteGetList
djhi Nov 22, 2023
984ed31
Fix useGetMany
djhi Nov 22, 2023
a2207c4
Fix CoreAdminRoutes
djhi Nov 22, 2023
ab9bbe0
Fix useCreatePath
djhi Nov 22, 2023
ae4388f
Fix Resource
djhi Nov 22, 2023
2bb0ad9
Fix useHandleAuthCallback
djhi Nov 22, 2023
feeea9c
Fix useAuthenticated
djhi Nov 22, 2023
2e890cd
Fix Authenticated
djhi Nov 22, 2023
f65459e
Fix useUpdate
djhi Nov 22, 2023
958811f
Fix useDelete
djhi Nov 22, 2023
5966771
Fix useListController
djhi Nov 22, 2023
7455168
Fix useInfiniteListController
djhi Nov 22, 2023
e33f02b
Fix ReferenceManyField
djhi Nov 22, 2023
37c4578
Fix some ra-ui-materialui tests
djhi Nov 22, 2023
76f3b39
Upgrade MUI
djhi Nov 23, 2023
34359e8
Fix remaining tests
djhi Nov 23, 2023
8d3703c
Fix build
djhi Nov 23, 2023
782c7c9
Fix data and error checks
djhi Nov 23, 2023
ce8fe48
Fix side effects
djhi Nov 23, 2023
927711f
Fix e2e tests
djhi Nov 23, 2023
3b569f0
Fix side effects management in useEditController
djhi Nov 23, 2023
d33e455
Fix lint error
djhi Nov 23, 2023
011ca15
Fix unstable test
djhi Nov 23, 2023
5271d97
Stabilize more tests
djhi Nov 23, 2023
eb91d20
Cleanup some test logs
djhi Nov 23, 2023
00f25a5
Add upgrade guide
djhi Nov 24, 2023
0eae7ec
Explain side effects handling in useEditController
djhi Nov 24, 2023
e1e9db4
Fix form props
djhi Nov 24, 2023
fe3d1df
Fix simple example
djhi Nov 24, 2023
da68f59
Fix simple example build for e2e
djhi Nov 24, 2023
bea5ff1
Upgrade to yarn v4
djhi Nov 24, 2023
fd7d671
Use node 18 in GH Actions
djhi Nov 24, 2023
cd30bb4
Disable HardenedMode
djhi Nov 24, 2023
415653c
Remove unnecessary comment
djhi Nov 27, 2023
f0c0f7f
Revert unnecessary breaking changes
djhi Nov 27, 2023
8230afc
Fix auth hooks and components
djhi Nov 27, 2023
63fd8c1
Simplify useHandleAuthCallback tests
djhi Nov 27, 2023
a72e735
Simplify simple example layout
djhi Nov 27, 2023
d3dfe38
Avoid authProvider changes
djhi Nov 27, 2023
fc9e231
Wrap user onSuccess and onError in useEvent
djhi Nov 27, 2023
2f48b32
Fix tests
djhi Nov 27, 2023
0a05e10
Move side effect handling to useUpdate
djhi Nov 27, 2023
525335b
Cleanup useUpdate
djhi Nov 28, 2023
7795bc9
Handle side effects in useUpdateMany
djhi Nov 28, 2023
c7d016d
Handle side effects in useDeleteMany & useDelete
djhi Nov 28, 2023
fa6afbc
Stabilize tests
djhi Nov 28, 2023
91c3064
Handle side effects in useCreate
djhi Nov 28, 2023
725fc5e
Move side effects at declaration time on useCreateController
djhi Nov 28, 2023
57ec1f9
Cleanup useInfiniteListController
djhi Nov 28, 2023
037c745
Format
djhi Nov 28, 2023
bed0034
Apply review suggestions
djhi Nov 28, 2023
f04c1f5
Fix side effects are executed twice on update
djhi Nov 28, 2023
db13b91
More upgrade instructions
fzaninotto Nov 29, 2023
0c04fff
[no ci] Fix incorrect upgrade instructions
fzaninotto Nov 29, 2023
66c4a98
Compactify
fzaninotto Nov 29, 2023
f3de1bc
Revert authentication related hooks changes
djhi Nov 29, 2023
f67760e
Use IsPending
djhi Nov 29, 2023
2ba92ba
Fix useReference tests
djhi Nov 29, 2023
1b69309
Fix Form Types
djhi Dec 4, 2023
0c3d7ab
Fix usePrevNextController
djhi Dec 4, 2023
13223b6
Fix useGetIdentity
djhi Dec 4, 2023
580446c
Fix more tests
djhi Dec 4, 2023
884a6f6
Fix useReferenceInputController
djhi Dec 4, 2023
883fbd3
Add more timeout on AutocompleteInput test
djhi Dec 4, 2023
158ce05
Simplify upgrade guide [skip-ci]
djhi Dec 4, 2023
713dfe2
Apply review suggestions
djhi Dec 6, 2023
a095293
Add onSettled support
djhi Dec 6, 2023
3fdbf51
Return null in useHandleAuthCallback
djhi Dec 6, 2023
6de1ab0
Apply review suggestions
djhi Dec 8, 2023
b89d378
Revert change on useAuthState to avoid BC
djhi Dec 8, 2023
fd48c78
Apply review suggestions
djhi Dec 8, 2023
f44a4c8
Fix eslint
djhi Dec 8, 2023
54c7eb7
Fix usePermissions
djhi Dec 8, 2023
26a0357
Fix useGetIdentity
djhi Dec 8, 2023
8a3aad6
Revert unnecessary changes
djhi Dec 8, 2023
9d3ca2b
Test false value in useAuthState
djhi Dec 8, 2023
b05bb58
Fix broken story
fzaninotto Dec 8, 2023
d804c14
Fix crm app
fzaninotto Dec 8, 2023
6d43aa2
Fix tutorial
fzaninotto Dec 8, 2023
49170f5
Fix ra-no-code
fzaninotto Dec 8, 2023
3dbffcf
Revert mui dep change
djhi Dec 8, 2023
317bd17
Apply review suggestions
djhi Dec 11, 2023
20b7931
Revert test change
djhi Dec 11, 2023
1fadea7
Don't trigger side effects while fetching
djhi Dec 11, 2023
85a21f4
Don't trigger side effects while fetching in auth hooks
djhi Dec 11, 2023
5300d06
Fix react query doc links
djhi Dec 13, 2023
a24aa9e
Apply suggestions from code review
djhi Dec 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
djhi marked this conversation as resolved.
Show resolved Hide resolved
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand Down
363 changes: 0 additions & 363 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
compressionLevel: 0

enableGlobalCache: true
enableHardenedMode: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues with jest without it


nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.1.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
3 changes: 3 additions & 0 deletions cypress/e2e/list.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ describe('List Page', () => {
LoginPage.login('admin', 'password');
ListPagePosts.navigate();
ListPagePosts.showFilter('title');
cy.get(ListPagePosts.elements.filter('title')).should(el =>
expect(el).to.have.value('Qui tempore rerum et voluptates')
);
ListPagePosts.setFilterValue(
'title',
'Omnis voluptate enim similique est possimus'
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/mobile.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ describe('Mobile UI', () => {
});

describe('Infinite Scroll', () => {
it.only('should load more items when scrolling to the bottom of the page', () => {
djhi marked this conversation as resolved.
Show resolved Hide resolved
it('should load more items when scrolling to the bottom of the page', () => {
ListPagePosts.navigate();
cy.contains('Sint dignissimos in architecto aut');
cy.contains('Sed quo et et fugiat modi').should('not.exist');
cy.scrollTo('bottom');
djhi marked this conversation as resolved.
Show resolved Hide resolved
cy.wait(500);
cy.scrollTo('bottom');
cy.contains('Sint dignissimos in architecto aut').scrollIntoView();
cy.contains('Sed quo et et fugiat modi');
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/CustomFormPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default url => ({
"[data-testid='dialog-add-post'] button[type='submit']",
submitAndAddButton:
".create-page form>div:last-child button[type='button']",
postSelect: '.ra-input-post_id [role="button"]',
postSelect: '.ra-input-post_id',
postItem: id => `li[data-value="${id}"]`,
showPostCreateModalButton: '[data-value="@@ra-create"]',
showPostPreviewModalButton: '[data-testid="button-show-post"]',
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/ListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default url => ({
filter: name => `.filter-field[data-source='${name}'] input`,
filterButton: name => `.filter-field[data-source='${name}']`,
filterMenuItems: `.new-filter-item`,
menuItems: `[role=menuitem]`,
menuItems: `a[role=menuitem]`,
filterMenuItem: source => `.new-filter-item[data-key="${source}"]`,
hideFilterButton: source =>
`.filter-field[data-source="${source}"] .hide-filter`,
Expand Down
95 changes: 94 additions & 1 deletion docs/Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,99 @@ title: "Upgrading to v5"

# Upgrading to v5

djhi marked this conversation as resolved.
Show resolved Hide resolved
## React 18

React-admin v5 uses React 18. If you use react-admin as a library in your own application, you'll have to upgrade to React 18 as well.

The React team has published a [migration guide](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) to help you upgrade. On most projects, this should be a matter of updating the root file of your application:

```diff
-import { render } from 'react-dom';
-const container = document.getElementById('app');
-render(<App tab="home" />, container);
+import { createRoot } from 'react-dom/client';
+const container = document.getElementById('app');
+const root = createRoot(container); // createRoot(container!) if you use TypeScript
+root.render(<App tab="home" />);
```

React 18 adds out-of-the-box performance improvements by doing more batching by default.

## Drop support for IE11

React-admin v5 uses React 18, which dropped support for Internet Explorer. If you need to support IE11, you'll have to stay on react-admin v4.

## Use `@tanstack/react-query` instead of `react-query`

React-admin now uses `react-query` v5 instead of v3. The library name has changed to `@tanstack/react-query` (but it's almost the same API).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
React-admin now uses `react-query` v5 instead of v3. The library name has changed to `@tanstack/react-query` (but it's almost the same API).
React-admin now uses `tanstack-query` v5 instead of `react-query` v3. The library name has changed to `@tanstack/react-query` (but it's almost the same API).

Shouldn't we use the name tanstack-query instead of react-query from now on?


If you used `react-query` directly in your code, you'll have to update it, following their migration guides:

- [From react-query v3 to @transtack/query v4](https://tanstack.com/query/v5/docs/react/guides/migrating-to-react-query-4)
- [From @transtack/query v4 to @transtack/query v5](https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5).

Here is a focus of the most important changes.

The package has been renamed to `@tanstack/react-query` so you'll have to change your imports:

```diff
-import { useQuery } from 'react-query';
+import { useQuery } from '@tanstack/react-query';
```

All react-query hooks, `queryClient` and `queryCache` methods now accept a single object argument:

```diff
- useQuery(key, fn, options)
+ useQuery({ queryKey, queryFn, ...options })
- useInfiniteQuery(key, fn, options)
+ useInfiniteQuery({ queryKey, queryFn, ...options })
- useMutation(fn, options)
+ useMutation({ mutationFn, ...options })
- useIsFetching(key, filters)
+ useIsFetching({ queryKey, ...filters })
- useIsMutating(key, filters)
+ useIsMutating({ mutationKey, ...filters })

- queryClient.isFetching(key, filters)
+ queryClient.isFetching({ queryKey, ...filters })
- queryClient.ensureQueryData(key, filters)
+ queryClient.ensureQueryData({ queryKey, ...filters })
- queryClient.getQueriesData(key, filters)
+ queryClient.getQueriesData({ queryKey, ...filters })
- queryClient.setQueriesData(key, updater, filters, options)
+ queryClient.setQueriesData({ queryKey, ...filters }, updater, options)
- queryClient.removeQueries(key, filters)
+ queryClient.removeQueries({ queryKey, ...filters })
- queryClient.resetQueries(key, filters, options)
+ queryClient.resetQueries({ queryKey, ...filters }, options)
- queryClient.cancelQueries(key, filters, options)
+ queryClient.cancelQueries({ queryKey, ...filters }, options)
- queryClient.invalidateQueries(key, filters, options)
+ queryClient.invalidateQueries({ queryKey, ...filters }, options)
- queryClient.refetchQueries(key, filters, options)
+ queryClient.refetchQueries({ queryKey, ...filters }, options)
- queryClient.fetchQuery(key, fn, options)
+ queryClient.fetchQuery({ queryKey, queryFn, ...options })
- queryClient.prefetchQuery(key, fn, options)
+ queryClient.prefetchQuery({ queryKey, queryFn, ...options })
- queryClient.fetchInfiniteQuery(key, fn, options)
+ queryClient.fetchInfiniteQuery({ queryKey, queryFn, ...options })
- queryClient.prefetchInfiniteQuery(key, fn, options)
+ queryClient.prefetchInfiniteQuery({ queryKey, queryFn, ...options })

- queryCache.find(key, filters)
+ queryCache.find({ queryKey, ...filters })
- queryCache.findAll(key, filters)
+ queryCache.findAll({ queryKey, ...filters })
```

## Removed deprecated hooks

The following deprecated hooks have been removed

- `usePermissionsOptimized`. Use `usePermissions` instead.

## `<Datagrid rowClick>` is no longer `false` by default

`<Datagrid>` will now make the rows clickable as soon as a Show or Edit view is declared on the resource (using the [resource definition](https://marmelab.com/react-admin/Resource.html)).
Expand All @@ -20,4 +113,4 @@ If you previously relied on the fact that the rows were not clickable by default

## Upgrading to v4

If you are on react-admin v3, follow the [Upgrading to v4](https://marmelab.com/react-admin/doc/4.16/Upgrade.html) guide before upgrading to v5.
If you are on react-admin v3, follow the [Upgrading to v4](https://marmelab.com/react-admin/doc/4.16/Upgrade.html) guide before upgrading to v5.
20 changes: 10 additions & 10 deletions examples/crm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
"private": true,
"dependencies": {
"@hello-pangea/dnd": "^16.3.0",
"@mui/icons-material": "^5.0.1",
"@mui/material": "^5.0.2",
"@mui/icons-material": "^5.14.18",
djhi marked this conversation as resolved.
Show resolved Hide resolved
"@mui/material": "^5.14.18",
"@nivo/bar": "^0.80.0",
"@nivo/core": "^0.80.0",
"clsx": "^1.1.1",
"date-fns": "^2.19.0",
"faker": "~5.4.0",
"lodash": "~4.17.5",
"prop-types": "^15.7.2",
"prop-types": "^15.8.1",
"ra-data-fakerest": "^4.12.0",
"react": "^17.0.0",
"react": "^18.0.0",
"react-admin": "^4.12.0",
"react-dom": "^17.0.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-router": "^6.1.0",
"react-router-dom": "^6.1.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/faker": "^5.1.7",
"@types/jest": "^29.5.2",
"@types/lodash": "~4.14.168",
"@types/react": "^17.0.20",
"@types/react-dom": "^17.0.9",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.16",
"@vitejs/plugin-react": "^2.2.0",
"rollup-plugin-visualizer": "^5.9.2",
"typescript": "^5.1.3",
Expand Down
10 changes: 6 additions & 4 deletions examples/crm/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
const container = document.getElementById('root');
const root = createRoot(container!);

root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/notes/NewNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const NewNote = ({
const [text, setText] = useState('');
const [status, setStatus] = useState(record && record.status);
const [date, setDate] = useState(getCurrentDate());
const [create, { isLoading }] = useCreate();
const [create, { isPending }] = useCreate();
const [update] = useUpdate();
const notify = useNotify();
const { identity } = useGetIdentity();
Expand Down Expand Up @@ -124,7 +124,7 @@ export const NewNote = ({
type="submit"
variant="contained"
color="primary"
disabled={!text || isLoading}
disabled={!text || isPending}
>
Add this note
</Button>
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/notes/Note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Note = ({
const record = useRecordContext();
const notify = useNotify();

const [update, { isLoading }] = useUpdate();
const [update, { isPending }] = useUpdate();

const [deleteNote] = useDelete(
resource,
Expand Down Expand Up @@ -150,7 +150,7 @@ export const Note = ({
type="submit"
color="primary"
variant="contained"
disabled={isLoading}
disabled={isPending}
>
Update Note
</Button>
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default defineConfig({
preserveSymlinks: true,
alias: [
// allow profiling in production
{ find: 'react-dom', replacement: 'react-dom/profiling' },
// { find: 'react-dom', replacement: 'react-dom/profiling' },
fzaninotto marked this conversation as resolved.
Show resolved Hide resolved
{
find: 'scheduler/tracing',
replacement: 'scheduler/tracing-profiling',
Expand Down
16 changes: 8 additions & 8 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"dependencies": {
"@apollo/client": "^3.3.19",
"@mui/icons-material": "^5.0.1",
"@mui/material": "^5.0.2",
"@mui/icons-material": "^5.14.18",
"@mui/material": "^5.14.18",
"@types/inflection": "^1.5.28",
"@types/recharts": "^1.8.10",
"@vitejs/plugin-react": "^2.2.0",
Expand All @@ -18,7 +18,7 @@
"graphql-tag": "^2.12.6",
"inflection": "~1.12.0",
"json-graphql-server": "~2.3.0",
"prop-types": "^15.6.1",
"prop-types": "^15.8.1",
"proxy-polyfill": "^0.3.0",
"query-string": "^7.1.1",
"ra-data-fakerest": "^4.12.0",
Expand All @@ -29,10 +29,10 @@
"ra-input-rich-text": "^4.12.0",
"ra-language-english": "^4.12.0",
"ra-language-french": "^4.12.0",
"react": "^17.0.0",
"react": "^18.0.0",
"react-admin": "^4.12.0",
"react-app-polyfill": "^2.0.0",
"react-dom": "^17.0.0",
"react-dom": "^18.2.0",
"react-router": "^6.1.0",
"react-router-dom": "^6.1.0",
"recharts": "^2.1.15"
Expand All @@ -46,9 +46,9 @@
"@types/fetch-mock": "^7.3.2",
"@types/jest": "^29.5.2",
"@types/node": "^12.12.14",
"@types/prop-types": "^15.6.0",
"@types/react": "^17.0.20",
"@types/react-dom": "^17.0.9",
"@types/prop-types": "^15.7.11",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.16",
"@vitejs/plugin-react": "^2.2.0",
"rewire": "^5.0.0",
"rollup-plugin-visualizer": "^5.9.2",
Expand Down
13 changes: 8 additions & 5 deletions examples/demo/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'proxy-polyfill';

djhi marked this conversation as resolved.
Show resolved Hide resolved
import * as React from 'react';
import ReactDOM from 'react-dom';
fzaninotto marked this conversation as resolved.
Show resolved Hide resolved
import { createRoot } from 'react-dom/client';

import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container) {
throw new Error('No container found');
}
const root = createRoot(container);

root.render(<App />);
4 changes: 2 additions & 2 deletions examples/demo/src/reviews/AcceptButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AcceptButton = () => {
const redirectTo = useRedirect();
const record = useRecordContext<Review>();

const [approve, { isLoading }] = useUpdate(
const [approve, { isPending }] = useUpdate(
'reviews',
{ id: record.id, data: { status: 'accepted' }, previousData: record },
{
Expand Down Expand Up @@ -49,7 +49,7 @@ const AcceptButton = () => {
startIcon={
<ThumbUp sx={{ color: theme => theme.palette.success.main }} />
}
disabled={isLoading}
disabled={isPending}
>
{translate('resources.reviews.action.accept')}
</Button>
Expand Down
Loading
Loading