Skip to content

Commit 98bf0bf

Browse files
committed
Add a story to test warning when using different meta with redirect false.
1 parent 9cf2fa3 commit 98bf0bf

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/ra-core/src/controller/edit/useEditController.stories.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,40 @@ export const EncodedIdWithPercentage = ({
7575
);
7676
};
7777

78+
export const WarningLogWithDifferentMeta = () => (
79+
<TestMemoryRouter initialEntries={['/posts/5']}>
80+
<CoreAdminContext
81+
dataProvider={testDataProvider({
82+
getOne: (_resource, { id }) =>
83+
Promise.resolve({
84+
data: { id, title: 'hello' } as any,
85+
}),
86+
})}
87+
>
88+
<Routes>
89+
<Route
90+
path="/posts/:id"
91+
element={
92+
<EditController
93+
resource="posts"
94+
queryOptions={{ meta: { foo: 'bar' } }}
95+
redirect={false}
96+
>
97+
{({ record }) => (
98+
<>
99+
<LocationInspector />
100+
<p>Id: {record && record.id}</p>
101+
<p>Title: {record && record.title}</p>
102+
</>
103+
)}
104+
</EditController>
105+
}
106+
/>
107+
</Routes>
108+
</CoreAdminContext>
109+
</TestMemoryRouter>
110+
);
111+
78112
const LocationInspector = () => {
79113
const location = useLocation();
80114
return (

0 commit comments

Comments
 (0)