From 727df24f59e5abf209f3818a03ffeeea21cbe803 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 02:23:06 +0700 Subject: [PATCH] chore(lint): memoize inline styles in workspace-desktop-tabs-row --- .../workspace/workspace-desktop-tabs-row.tsx | 75 ++++++++++++------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx b/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx index 26d8c8258..bed4f8429 100644 --- a/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx +++ b/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx @@ -253,6 +253,27 @@ function TabChip({ [], ); + const tabAccessibilityState = useMemo(() => ({ selected: isActive }), [isActive]); + const tabFocusIndicatorStyle = useMemo( + () => [styles.tabFocusIndicator, !isFocused && styles.tabFocusIndicatorUnfocused], + [isFocused], + ); + const tabLabelSkeletonStyle = useMemo( + () => [ + styles.tabLabelSkeleton, + showCloseButton && styles.tabLabelSkeletonWithCloseButton, + ], + [showCloseButton], + ); + const tabLabelStyle = useMemo( + () => [ + styles.tabLabel, + isHighlighted && styles.tabLabelActive, + showCloseButton && styles.tabLabelWithCloseButton, + ], + [isHighlighted, showCloseButton], + ); + return ( @@ -271,36 +292,20 @@ function TabChip({ onPress={handleNavigateTab} accessibilityRole="button" accessibilityLabel={tooltipLabel} - accessibilityState={{ selected: isActive }} + accessibilityState={tabAccessibilityState} aria-selected={isActive} > - {isActive && ( - - )} + {isActive && } {showLabel ? ( presentation.titleState === "loading" ? ( - + ) : ( [ + styles.tabsScroll, + layout.requiresHorizontalScrollFallback + ? styles.tabsScrollOverflow + : styles.tabsScrollFitContent, + ], + [layout.requiresHorizontalScrollFallback], + ); + return ( @@ -792,7 +802,7 @@ function ResolvedDesktopTabChip({ return ( {showDropIndicatorBefore ? ( - + ) : null} {showDropIndicatorAfter ? ( - + ) : null} ); @@ -985,3 +995,12 @@ const styles = StyleSheet.create((theme) => ({ fontSize: theme.fontSize.xs, }, })); + +const TAB_DROP_INDICATOR_BEFORE_STYLE = [ + styles.tabDropIndicator, + styles.tabDropIndicatorBefore, +]; +const TAB_DROP_INDICATOR_AFTER_STYLE = [ + styles.tabDropIndicator, + styles.tabDropIndicatorAfter, +];