Skip to content

Commit 72a7674

Browse files
committed
fix(homepage): clean up GSAP DOM classes on perspective toggle
useGSAP's ctx.revert() only cleans up GSAP-managed inline styles, not imperative classList additions. Add cleanup function to remove stale arrow-line/arrow-head 'active' and row 'row-match'/'row-dim' classes when isDev changes, preventing visual glitches on toggle.
1 parent 9b78010 commit 72a7674

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/homepage/components/bridges/bridge-decision.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ export function BridgeDecision({ perspective }: BridgeDecisionProps) {
242242
}
243243

244244
gsap.delayedCall(0.3, runCycle)
245+
246+
// Cleanup: remove DOM classes that GSAP context.revert() won't catch
247+
return () => {
248+
container.querySelectorAll('.arrow-line, .arrow-head').forEach((el) => {
249+
el.classList.remove('active')
250+
})
251+
rows.forEach((r) => r.classList.remove('row-match', 'row-dim'))
252+
}
245253
},
246254
{ scope: containerRef, dependencies: [isDev, animateParticle] },
247255
)

0 commit comments

Comments
 (0)