diff --git a/packages/ra-ui-materialui/src/list/SimpleList.spec.tsx b/packages/ra-ui-materialui/src/list/SimpleList.spec.tsx
index 4eea79fabe3..b3bf28344f1 100644
--- a/packages/ra-ui-materialui/src/list/SimpleList.spec.tsx
+++ b/packages/ra-ui-materialui/src/list/SimpleList.spec.tsx
@@ -49,4 +49,90 @@ describe('', () => {
).not.toBeNull();
});
});
+
+ it.each([
+ [
+ 'edit',
+ 'edit',
+ ['http://localhost/posts/1', 'http://localhost/posts/2'],
+ ],
+ [
+ 'show',
+ 'show',
+ ['http://localhost/posts/1/show', 'http://localhost/posts/2/show'],
+ ],
+ [
+ 'custom',
+ (record, id) => `/posts/${id}/custom`,
+ [
+ 'http://localhost/posts/1/custom',
+ 'http://localhost/posts/2/custom',
+ ],
+ ],
+ ])(
+ 'should render %s links for each item',
+ async (_, link, expectedUrls) => {
+ const { getByText } = renderWithRouter(
+
+ record.id.toString()}
+ secondaryText={}
+ />
+
+ );
+
+ await waitFor(() => {
+ expect(getByText('1').closest('a').href).toEqual(
+ expectedUrls[0]
+ );
+ expect(getByText('2').closest('a').href).toEqual(
+ expectedUrls[1]
+ );
+ });
+ }
+ );
+
+ it('should not render links if linkType is false', async () => {
+ const { getByText } = renderWithRouter(
+
+ record.id.toString()}
+ secondaryText={}
+ />
+
+ );
+
+ await waitFor(() => {
+ expect(getByText('1').closest('a')).toBeNull();
+ expect(getByText('2').closest('a')).toBeNull();
+ });
+ });
});
diff --git a/packages/ra-ui-materialui/src/list/SimpleList.tsx b/packages/ra-ui-materialui/src/list/SimpleList.tsx
index fea434a2ac8..df5d84b1ba8 100644
--- a/packages/ra-ui-materialui/src/list/SimpleList.tsx
+++ b/packages/ra-ui-materialui/src/list/SimpleList.tsx
@@ -131,7 +131,8 @@ const SimpleList = (
record={data[id]}
>
{
>
{children}
+ ) : link !== false ? (
+
+ {children}
+
) : (
{children}
);