Skip to content

Commit e0ad72c

Browse files
silkservicehaschek
authored andcommitted
Performance improvement: Delay rendering of interaction elements of overview items when marked as hidden
1 parent 13117c7 commit e0ad72c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/components/OverviewItem/OverviewItemActions.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ export const OverviewItemActions = ({
1919
hiddenInteractions = false,
2020
...restProps
2121
}: OverviewItemActionsProps) => {
22+
const [showActions, setShowActions] = React.useState(!hiddenInteractions)
23+
24+
React.useEffect(() => {
25+
// Delay rendering of item actions when they are hidden anyways, because rendering interaction elements like context menus currently has a large performance impact.
26+
setTimeout(() => setShowActions(true), 1)
27+
}, [])
28+
2229
return (
2330
<div
2431
{...restProps}
@@ -28,7 +35,7 @@ export const OverviewItemActions = ({
2835
(className ? ` ${className}` : "")
2936
}
3037
>
31-
{children}
38+
{showActions ? children : null}
3239
</div>
3340
);
3441
};

0 commit comments

Comments
 (0)