Skip to content

Commit 1238656

Browse files
committed
Update WithListContext usages.
1 parent bae5427 commit 1238656

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

packages/ra-core/src/controller/field/ReferenceManyFieldBase.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { onlineManager, QueryClient } from '@tanstack/react-query';
3-
import { RecordsIterator, WithListContext } from 'ra-core';
3+
import { RecordsIterator } from 'ra-core';
44
import { CoreAdmin } from '../../core/CoreAdmin';
55
import { Resource } from '../../core/Resource';
66
import { ShowBase } from '../../controller/show/ShowBase';

packages/ra-core/src/controller/list/RecordsIterator.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const UsingRender = ({
3636
<ListContextProvider value={value}>
3737
<WithListContext
3838
loading={<div>Loading...</div>}
39-
errorElement={<div>Error</div>}
39+
error={<div>Error</div>}
4040
offline={<div>Offline</div>}
4141
empty={<div>No data</div>}
4242
>
@@ -101,7 +101,7 @@ export const UsingChildren = ({
101101
<ListContextProvider value={value}>
102102
<WithListContext
103103
loading={<div>Loading...</div>}
104-
errorElement={<div>Error</div>}
104+
error={<div>Error</div>}
105105
offline={<div>Offline</div>}
106106
empty={<div>No data</div>}
107107
>

packages/ra-core/src/controller/list/WithListContext.stories.tsx

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -323,38 +323,35 @@ export const Error = () => (
323323
<CoreAdminContext dataProvider={erroredDataProvider}>
324324
<ListBase resource="fruits" disableSyncWithLocation perPage={100}>
325325
<WithListContext<Fruit>
326-
errorElement={<p>Error loading data</p>}
327-
render={({ isPending, data, total }) =>
328-
isPending ? (
329-
<>Loading...</>
330-
) : (
331-
<table style={{ borderSpacing: '30px 5px' }}>
332-
<thead>
333-
<tr>
334-
<th>Date</th>
335-
<th>Apples</th>
336-
<th>Blueberries</th>
337-
<th>Carrots</th>
338-
</tr>
339-
</thead>
340-
<tbody>
341-
{data.map(fruit => (
342-
<tr key={fruit.id}>
343-
<td>{fruit.date}</td>
344-
<td>{fruit.apples}</td>
345-
<td>{fruit.blueberries}</td>
346-
<td>{fruit.carrots}</td>
347-
</tr>
348-
))}
349-
</tbody>
350-
<tfoot>
351-
<tr>
352-
<td colSpan={4}>Total: {total}</td>
326+
loading={<>Loading...</>}
327+
error={<p>Error loading data</p>}
328+
render={({ data, total }) => (
329+
<table style={{ borderSpacing: '30px 5px' }}>
330+
<thead>
331+
<tr>
332+
<th>Date</th>
333+
<th>Apples</th>
334+
<th>Blueberries</th>
335+
<th>Carrots</th>
336+
</tr>
337+
</thead>
338+
<tbody>
339+
{data.map(fruit => (
340+
<tr key={fruit.id}>
341+
<td>{fruit.date}</td>
342+
<td>{fruit.apples}</td>
343+
<td>{fruit.blueberries}</td>
344+
<td>{fruit.carrots}</td>
353345
</tr>
354-
</tfoot>
355-
</table>
356-
)
357-
}
346+
))}
347+
</tbody>
348+
<tfoot>
349+
<tr>
350+
<td colSpan={4}>Total: {total}</td>
351+
</tr>
352+
</tfoot>
353+
</table>
354+
)}
358355
/>
359356
</ListBase>
360357
</CoreAdminContext>

0 commit comments

Comments
 (0)