Skip to content

Commit 844a7bd

Browse files
authored
test(ActionList): add parent re-render stress test
1 parent d97ff12 commit 844a7bd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

packages/react/src/ActionList/ActionList.stress.dev.stories.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,31 @@ export const SingleSelect = () => {
4848
/>
4949
)
5050
}
51+
52+
export const ParentRerender = () => {
53+
return (
54+
<StressTest
55+
componentName="ActionList"
56+
title="Parent Re-render"
57+
description="Parent re-renders without changing item props. Tests context memoization: without useMemo on context values, all items re-render even though nothing changed for them."
58+
totalIterations={totalIterations}
59+
renderIteration={() => {
60+
return (
61+
<>
62+
<ActionList selectionVariant="single" showDividers role="menu" aria-label="Project">
63+
{projects.map((project, index) => (
64+
<ActionList.Item key={index} role="menuitemradio" selected={index === 0} aria-checked={index === 0}>
65+
<ActionList.LeadingVisual>
66+
<TableIcon />
67+
</ActionList.LeadingVisual>
68+
{project.name}
69+
<ActionList.Description variant="block">{project.scope}</ActionList.Description>
70+
</ActionList.Item>
71+
))}
72+
</ActionList>
73+
</>
74+
)
75+
}}
76+
/>
77+
)
78+
}

0 commit comments

Comments
 (0)