@@ -2,9 +2,9 @@ import * as React from 'react';
22import { Location } from 'react-router' ;
33import { QueryClient } from '@tanstack/react-query' ;
44import { AuthProvider } from '../types' ;
5- import { CoreAdminContext } from '../core' ;
5+ import { CoreAdminContext } from '../core/CoreAdminContext ' ;
66import { CanAccess } from './CanAccess' ;
7- import { TestMemoryRouter } from '..' ;
7+ import { TestMemoryRouter } from '../routing/TestMemoryRouter ' ;
88
99export default {
1010 title : 'ra-core/auth/CanAccess' ,
@@ -109,3 +109,45 @@ export const NoAuthProvider = () => (
109109 </ CoreAdminContext >
110110 </ TestMemoryRouter >
111111) ;
112+
113+ const data = Array . from ( { length : 1000 } , ( _ , i ) => {
114+ const post = {
115+ id : i + 1 ,
116+ title : `Post ${ i + 1 } ` ,
117+ body : `This is the body of post ${ i + 1 } ` ,
118+ } ;
119+
120+ Array . from ( { length : 100 } , ( _ , i ) => {
121+ post [ `property${ i + 1 } ` ] = `Another very long property ${ i + 1 } ` ;
122+ } ) ;
123+
124+ return post ;
125+ } ) ;
126+
127+ export const ManyCalls = ( {
128+ authProvider = defaultAuthProvider ,
129+ queryClient,
130+ } : {
131+ authProvider ?: AuthProvider | null ;
132+ queryClient ?: QueryClient ;
133+ } ) => (
134+ < TestMemoryRouter >
135+ < CoreAdminContext
136+ authProvider = { authProvider != null ? authProvider : undefined }
137+ queryClient = { queryClient }
138+ >
139+ < div >
140+ { data . map ( post => (
141+ < CanAccess
142+ key = { post . id }
143+ action = "read"
144+ resource = "posts"
145+ record = { post }
146+ >
147+ < div > { post . title } </ div >
148+ </ CanAccess >
149+ ) ) }
150+ </ div >
151+ </ CoreAdminContext >
152+ </ TestMemoryRouter >
153+ ) ;
0 commit comments