Skip to content

Commit 2b3a3f7

Browse files
committed
fix: address review feedback — stale closure and unused prop
- Save hoveredIndex to local variable before clearing to avoid confusing stale closure read (Cursor Bugbot + Greptile feedback) - Remove unused onMouseLeave prop from IconButtonProps since mouse-leave is handled by the container div AI Disclosure: This commit was authored by Claude Opus 4.6 (Anthropic), an AI agent operated by Maxwell Calkin (@MaxwellCalkin).
1 parent bcd2aab commit 2b3a3f7

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

apps/sim/app/(landing)/components/hero/components/icon-button.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ interface IconButtonProps {
77
children: React.ReactNode
88
onClick?: () => void
99
onMouseEnter?: () => void
10-
onMouseLeave?: () => void
1110
style?: React.CSSProperties
1211
'aria-label': string
1312
isActive?: boolean
@@ -17,7 +16,6 @@ export function IconButton({
1716
children,
1817
onClick,
1918
onMouseEnter,
20-
onMouseLeave,
2119
style,
2220
'aria-label': ariaLabel,
2321
isActive = false,
@@ -28,7 +26,6 @@ export function IconButton({
2826
aria-label={ariaLabel}
2927
onClick={onClick}
3028
onMouseEnter={onMouseEnter}
31-
onMouseLeave={onMouseLeave}
3229
className='relative flex items-center justify-center rounded-xl p-2 outline-none'
3330
style={style}
3431
>

apps/sim/app/(landing)/components/hero/hero.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,12 @@ export default function Hero() {
245245
* Handle mouse leave on icon container
246246
*/
247247
const handleIconContainerMouseLeave = () => {
248+
const lastIndex = hoveredIndex
248249
setIsUserHovering(false)
249250
setHoveredIndex(null)
250251
// Start from the next icon after the last hovered one
251-
if (hoveredIndex !== null) {
252-
setAutoHoverIndex((hoveredIndex + 1) % visibleIconCount)
252+
if (lastIndex !== null) {
253+
setAutoHoverIndex((lastIndex + 1) % visibleIconCount)
253254
}
254255
}
255256

0 commit comments

Comments
 (0)