File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
packages/runtime-dom/src/components Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,7 @@ function whenTransitionEnds(
371371 let ended = 0
372372 const end = ( ) => {
373373 el . removeEventListener ( endEvent , onEnd )
374+ cancelFeedback ( )
374375 resolveIfNotStale ( )
375376 }
376377 const onEnd = ( e : Event ) => {
@@ -381,7 +382,12 @@ function whenTransitionEnds(
381382
382383 const fallbackTimeout = ( ) => {
383384 let loopStart : number | null = null
385+ let rafId : number
384386 const loop = ( timeStamp : number ) => {
387+ if ( id !== el . _endId ) {
388+ return
389+ }
390+
385391 if ( ! loopStart ) {
386392 loopStart = timeStamp
387393 }
@@ -390,17 +396,19 @@ function whenTransitionEnds(
390396 if ( elapsed >= timeout + 1 ) {
391397 if ( ended < propCount ) {
392398 end ( )
393- return
394399 }
400+ return
395401 }
396402
397- requestAnimationFrame ( loop )
403+ rafId = requestAnimationFrame ( loop )
398404 }
399405
400- requestAnimationFrame ( loop )
406+ rafId = requestAnimationFrame ( loop )
407+
408+ return ( ) => cancelAnimationFrame ( rafId )
401409 }
402410
403- fallbackTimeout ( )
411+ const cancelFeedback = fallbackTimeout ( )
404412
405413 el . addEventListener ( endEvent , onEnd )
406414}
You can’t perform that action at this time.
0 commit comments