From 63b39a08c939c8ce4cb1e0cd0fbdf1e445446522 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 8 Apr 2025 20:40:48 +0800 Subject: [PATCH] fix(mobile): optimize child handling in GroupedList component - Updated memoization of child elements in GroupedInsetListCard to depend on the children prop, improving rendering efficiency. This change enhances performance by ensuring that the component only re-renders when the children change. Signed-off-by: Innei --- apps/mobile/src/components/ui/grouped/GroupedList.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/components/ui/grouped/GroupedList.tsx b/apps/mobile/src/components/ui/grouped/GroupedList.tsx index 1aee7e390..11eb2d595 100644 --- a/apps/mobile/src/components/ui/grouped/GroupedList.tsx +++ b/apps/mobile/src/components/ui/grouped/GroupedList.tsx @@ -39,7 +39,10 @@ export const GroupedOutlineDescription: FC<{ export const GroupedInsetListCard: FC< PropsWithChildren & ViewProps & GroupedInsetListCardProps > = ({ children, className, showSeparator = true, SeparatorComponent, ...props }) => { - const nextChildren = React.useMemo(() => React.Children.toArray(children).filter(Boolean), []) + const nextChildren = React.useMemo( + () => React.Children.toArray(children).filter(Boolean), + [children], + ) return (