Skip to content

Commit 9da50cd

Browse files
committed
Revert story changes breaking inferred links.
1 parent 9dc920f commit 9da50cd

File tree

1 file changed

+45
-20
lines changed

1 file changed

+45
-20
lines changed

packages/ra-ui-materialui/src/list/SimpleList/SimpleList.stories.tsx

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ResourceContextProvider,
99
ResourceProps,
1010
ListBase,
11+
ResourceDefinitionContextProvider,
1112
} from 'ra-core';
1213
import defaultMessages from 'ra-language-english';
1314
import polyglotI18nProvider from 'ra-i18n-polyglot';
@@ -140,16 +141,28 @@ export const LinkType = ({
140141
locationCallback?: (l: Location) => void;
141142
}) => (
142143
<TestMemoryRouter locationCallback={locationCallback}>
143-
<AdminContext dataProvider={myDataProvider}>
144-
<ListBase resource="books" perPage={15}>
145-
<Alert color="info">Inferred should target edit</Alert>
146-
<SimpleList
147-
primaryText={record => record.title}
148-
secondaryText={record => record.author}
149-
tertiaryText={record => record.year}
150-
linkType={linkType}
151-
/>
152-
</ListBase>
144+
<AdminContext>
145+
<ResourceDefinitionContextProvider
146+
definitions={{
147+
books: {
148+
name: 'books',
149+
hasList: true,
150+
hasEdit: true,
151+
hasShow: false,
152+
},
153+
}}
154+
>
155+
<ResourceContextProvider value="books">
156+
<Alert color="info">Inferred should target edit</Alert>
157+
<SimpleList
158+
data={data.books}
159+
primaryText={record => record.title}
160+
secondaryText={record => record.author}
161+
tertiaryText={record => record.year}
162+
linkType={linkType}
163+
/>
164+
</ResourceContextProvider>
165+
</ResourceDefinitionContextProvider>
153166
</AdminContext>
154167
</TestMemoryRouter>
155168
);
@@ -180,16 +193,28 @@ export const RowClick = ({
180193
rowClick: string | RowClickFunction | false;
181194
}) => (
182195
<TestMemoryRouter locationCallback={locationCallback}>
183-
<AdminContext dataProvider={myDataProvider}>
184-
<ListBase resource="books" perPage={15}>
185-
<Alert color="info">Inferred should target edit</Alert>
186-
<SimpleList
187-
primaryText={record => record.title}
188-
secondaryText={record => record.author}
189-
tertiaryText={record => record.year}
190-
rowClick={rowClick}
191-
/>
192-
</ListBase>
196+
<AdminContext>
197+
<ResourceDefinitionContextProvider
198+
definitions={{
199+
books: {
200+
name: 'books',
201+
hasList: true,
202+
hasEdit: true,
203+
hasShow: false,
204+
},
205+
}}
206+
>
207+
<ResourceContextProvider value="books">
208+
<Alert color="info">Inferred should target edit</Alert>
209+
<SimpleList
210+
data={data.books}
211+
primaryText={record => record.title}
212+
secondaryText={record => record.author}
213+
tertiaryText={record => record.year}
214+
rowClick={rowClick}
215+
/>
216+
</ResourceContextProvider>
217+
</ResourceDefinitionContextProvider>
193218
</AdminContext>
194219
</TestMemoryRouter>
195220
);

0 commit comments

Comments
 (0)