You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a Users page with a data grid of users and then a child route of that page for the view form that fetches some additional data for a single user. We would like to cache the Users grid data so that we don't have to re-fetch the entire Users list when we open that child form. This scenario doesn't seem to be working for some reason as it's still fetching that entire Users list. The commented out code below works in this scenario, but the active code does not. Is there something I'm missing?
exportconstloader=customLoader({allowedRoles: ALLOWED_ROLES,loaderFn: async({ request }: Route.LoaderArgs)=>{constapiClient=createServerApiClient(request);const[users,userTypes,regions]=awaitPromise.all([apiClient.users.get(),apiClient.users.userTypes.get(),apiClient.regions.get(),]);return{ users, userTypes, regions };},});// let cachedData: any;// export async function clientLoader({ serverLoader }: Route.ClientLoaderArgs) {// if (cachedData) {// console.log('Returning cached data');// return cachedData;// }// cachedData = await serverLoader();// return cachedData;// }// clientLoader.hydrate = true;exportconstclientLoader=(args: Route.ClientLoaderArgs)=>cacheClientLoader(argsasany);clientLoader.hydrate=true;exportdefaultfunctionUsers(props: Route.ComponentProps){// const { users, userTypes, regions } = props.loaderData;const{ users, userTypes, regions }=useCachedLoaderData();return(<PageWrapper><UsersTableusers={usersasUserListItem[]}userTypes={userTypesasUserType[]}regions={regionsasRegion[]}/><Outlet/></PageWrapper>);}
The text was updated successfully, but these errors were encountered:
We have a Users page with a data grid of users and then a child route of that page for the view form that fetches some additional data for a single user. We would like to cache the Users grid data so that we don't have to re-fetch the entire Users list when we open that child form. This scenario doesn't seem to be working for some reason as it's still fetching that entire Users list. The commented out code below works in this scenario, but the active code does not. Is there something I'm missing?
The text was updated successfully, but these errors were encountered: