Skip to content

Commit d8f91b1

Browse files
nawan-bslax57claude
authored
Bump react-admin to 5.15.5 (#706)
* chore(deps): bump react-admin to 5.15.5 Keep API Platform Admin compatible with recent react-admin releases. The bump pulls MUI 9 and a newer TanStack Query, which required: - passing the mutation context to onSuccess/onError in useOnSubmit - replacing removed MUI system props with sx in stories - using ESM module mocking since react-hotkeys-hook is now ESM-only - updating nwsapi so jsdom can parse MUI 9 selectors * chore(deps): dedupe in yarn.lock * chore(deps): dedupe "babel/runtime" in yarn.lock * chore(deps): dedupe "babel/runtime" in yarn.lock for v8 * ci: use Node LTS instead of 'current' (now a v27 prerelease that breaks yarn 1) * fix(docker): adapt Caddyfile to new Mercure version shipped in frankenphp image * chore(docker): enable Mercure playground (replaces removed "demo" directive) * chore(docker): use Mercure "debugger" instead of "playground" In Mercure 1.1, the "playground" directive redirects the site root "/" to the debugger UI, which hijacks the API Platform entrypoint and breaks the admin (302 without CORS headers). "debugger" keeps the Mercure UI without side effects on "/". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Jean-Baptiste Kaiser <14542336+slax57@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ab9239c commit d8f91b1

9 files changed

Lines changed: 170 additions & 273 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Setup Node
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version: 'current'
19+
node-version: 'lts/*'
2020
-
2121
name: Enable corepack
2222
run: corepack enable

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
name: Setup Node
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 'current'
25+
node-version: 'lts/*'
2626
registry-url: https://registry.npmjs.org
2727
-
2828
name: Install dependencies

‎api/frankenphp/Caddyfile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@
4646
}
4747

4848
mercure {
49+
# Share the hub between the addresses listed in SERVER_NAME (e.g. "localhost, php:80")
50+
name default
4951
# Transport to use (default to Bolt)
50-
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
52+
transport bolt {
53+
path /data/mercure.db
54+
}
5155
# Publisher JWT key
5256
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
5357
# Subscriber JWT key
@@ -56,6 +60,8 @@
5660
anonymous
5761
# Enable the subscription API (double-check that it's what you want)
5862
subscriptions
63+
# Keep legacy publisher_jwt/subscriber_jwt directives (newer Mercure versions require an explicit opt-in)
64+
protocol_version_compatibility 8
5965
# Extra directives
6066
{$MERCURE_EXTRA_DIRECTIVES}
6167
}

‎compose.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure}
1919
MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
2020
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
21-
MERCURE_EXTRA_DIRECTIVES: demo
21+
MERCURE_EXTRA_DIRECTIVES: debugger
2222
# See https://xdebug.org/docs/all_settings#mode
2323
XDEBUG_MODE: "${XDEBUG_MODE:-off}"
2424
ports:

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@api-platform/api-doc-parser": "^0.16.8",
2222
"jsonld": "^8.3.2",
2323
"lodash.isplainobject": "^4.0.6",
24-
"react-admin": "^5.8.3"
24+
"react-admin": "^5.15.5"
2525
},
2626
"devDependencies": {
2727
"@babel/preset-env": "^7.23.3",

‎src/stories/custom/AdvancedCustomization.stories.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const BookCreate = () => (
5353
helperText={false}
5454
validate={required()}
5555
/>
56-
<Stack direction="row" gap={2} width="100%">
56+
<Stack direction="row" sx={{ gap: 2, width: '100%' }}>
5757
<InputGuesser source="isbn" label="ISBN" helperText={false} />
5858
<InputGuesser source="publicationDate" helperText={false} />
5959
</Stack>
@@ -72,7 +72,7 @@ const BookEdit = () => (
7272
helperText={false}
7373
validate={required()}
7474
/>
75-
<Stack direction="row" gap={2} width="100%">
75+
<Stack direction="row" sx={{ gap: 2, width: '100%' }}>
7676
<InputGuesser source="isbn" label="ISBN" helperText={false} />
7777
<InputGuesser source="publicationDate" helperText={false} />
7878
</Stack>
@@ -87,7 +87,7 @@ const BookShow = () => (
8787
<TextField source="title" variant="h5" />
8888
<TextField source="author" variant="body1" />
8989
<TextField source="description" variant="body1" />
90-
<SimpleShowLayout direction="row" gap={2} sx={{ p: 0 }}>
90+
<SimpleShowLayout direction="row" sx={{ gap: 2, p: 0 }}>
9191
<TextField source="isbn" label="ISBN" variant="body1" />
9292
<DateField source="publicationDate" variant="body1" />
9393
</SimpleShowLayout>

‎src/useOnSubmit.test.tsx‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import { jest } from '@jest/globals';
33
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
44
import { render, waitFor } from '@testing-library/react';
5+
import * as reactAdminActual from 'react-admin';
56
import {
67
type CreateResult,
78
DataProviderContext,
@@ -29,12 +30,7 @@ const onSubmitProps = {
2930

3031
jest.mock('./getIdentifierValue.js');
3132
const notify = jest.fn();
32-
const reactAdminActual = jest.requireActual('react-admin') as Record<
33-
string,
34-
unknown
35-
>;
36-
jest.mock('react-admin', () => ({
37-
__esModule: true,
33+
jest.unstable_mockModule('react-admin', () => ({
3834
...reactAdminActual,
3935
useNotify: () => notify,
4036
}));

‎src/useOnSubmit.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
22
import { useCreate, useNotify, useRedirect, useUpdate } from 'react-admin';
33
import type { HttpError, RaRecord } from 'react-admin';
44
import { useParams } from 'react-router-dom';
5+
import { useQueryClient } from '@tanstack/react-query';
56
import lodashIsPlainObject from 'lodash.isplainobject';
67

78
import getIdentifierValue from './getIdentifierValue.js';
@@ -33,6 +34,7 @@ const useOnSubmit = ({
3334
const [update] = useUpdate();
3435
const notify = useNotify();
3536
const redirect = useRedirect();
37+
const queryClient = useQueryClient();
3638

3739
return useCallback(
3840
async (values: Partial<RaRecord>) => {
@@ -83,6 +85,7 @@ const useOnSubmit = ({
8385
...(isCreate ? {} : { id, previousData: values }),
8486
},
8587
{},
88+
{ client: queryClient, meta: mutationOptions?.meta },
8689
);
8790

8891
return undefined;
@@ -119,6 +122,7 @@ const useOnSubmit = ({
119122
...(isCreate ? {} : { id, previousData: values }),
120123
},
121124
{},
125+
{ client: queryClient, meta: mutationOptions?.meta },
122126
);
123127
return submissionErrors ?? {};
124128
}
@@ -136,6 +140,7 @@ const useOnSubmit = ({
136140
transform,
137141
create,
138142
update,
143+
queryClient,
139144
],
140145
);
141146
};

0 commit comments

Comments
 (0)