File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ export const ViewTransitionMixin = <
1010 abstract class ViewTransitionClass extends superClass {
1111 private _slot ?: HTMLSlotElement ;
1212
13+ private _transitionTriggered = false ;
14+
1315 /**
1416 * Trigger a view transition if supported by the browser
1517 * @param updateCallback - Callback function that updates the DOM
@@ -47,9 +49,15 @@ export const ViewTransitionMixin = <
4749 * Check if slot has content and trigger transition if it does
4850 */
4951 private _checkSlotContent = ( ) : void => {
52+ // Guard against multiple slotchange events triggering the transition multiple times
53+ if ( this . _transitionTriggered ) {
54+ return ;
55+ }
56+
5057 if ( this . _slot ) {
5158 const elements = this . _slot . assignedElements ( ) ;
5259 if ( elements . length > 0 ) {
60+ this . _transitionTriggered = true ;
5361 this . onLoadTransition ?.( ) ;
5462 }
5563 }
You can’t perform that action at this time.
0 commit comments