File tree Expand file tree Collapse file tree
apps/sim/app/(landing)/blog/[slug] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ export function AnimatedColorBlocks() {
2525 const mounted = useRef ( true )
2626
2727 function schedule ( fn : ( ) => void , ms : number ) {
28- const id = setTimeout ( fn , ms )
28+ const id = setTimeout ( ( ) => {
29+ timers . current = timers . current . filter ( ( timerId ) => timerId !== id )
30+ fn ( )
31+ } , ms )
2932 timers . current . push ( id )
3033 return id
3134 }
@@ -116,7 +119,10 @@ export function AnimatedColorBlocksVertical() {
116119 const verticalColors = [ COLORS [ 0 ] , COLORS [ 1 ] , COLORS [ 2 ] ] as const
117120
118121 function schedule ( fn : ( ) => void , ms : number ) {
119- const id = setTimeout ( fn , ms )
122+ const id = setTimeout ( ( ) => {
123+ timers . current = timers . current . filter ( ( timerId ) => timerId !== id )
124+ fn ( )
125+ } , ms )
120126 timers . current . push ( id )
121127 return id
122128 }
You can’t perform that action at this time.
0 commit comments