@@ -748,68 +748,57 @@ export function schedule_effect(signal) {
748748 * bitwise flag passed in only. The collected effects array will be populated with all the user
749749 * effects to be flushed.
750750 *
751- * @param {Effect } effect
751+ * @param {Effect } root
752752 * @returns {Effect[] }
753753 */
754- function process_effects ( effect ) {
754+ function process_effects ( root ) {
755755 /** @type {Effect[] } */
756756 var effects = [ ] ;
757757
758- var current_effect = effect . first ;
758+ var effect = root . first ;
759759
760- main_loop: while ( current_effect !== null ) {
761- var flags = current_effect . f ;
760+ while ( effect !== null ) {
761+ var flags = effect . f ;
762762 var is_branch = ( flags & BRANCH_EFFECT ) !== 0 ;
763763 var is_skippable_branch = is_branch && ( flags & CLEAN ) !== 0 ;
764- var sibling = current_effect . next ;
765764
766765 if ( ! is_skippable_branch && ( flags & INERT ) === 0 ) {
767766 if ( ( flags & EFFECT ) !== 0 ) {
768- effects . push ( current_effect ) ;
767+ effects . push ( effect ) ;
769768 } else if ( is_branch ) {
770- current_effect . f ^= CLEAN ;
769+ effect . f ^= CLEAN ;
771770 } else {
772771 // Ensure we set the effect to be the active reaction
773772 // to ensure that unowned deriveds are correctly tracked
774773 // because we're flushing the current effect
775774 var previous_active_reaction = active_reaction ;
776775 try {
777- active_reaction = current_effect ;
778- if ( check_dirtiness ( current_effect ) ) {
779- update_effect ( current_effect ) ;
776+ active_reaction = effect ;
777+ if ( check_dirtiness ( effect ) ) {
778+ update_effect ( effect ) ;
780779 }
781780 } catch ( error ) {
782- handle_error ( error , current_effect , null , current_effect . ctx ) ;
781+ handle_error ( error , effect , null , effect . ctx ) ;
783782 } finally {
784783 active_reaction = previous_active_reaction ;
785784 }
786785 }
787786
788- var child = current_effect . first ;
787+ var child = effect . first ;
789788
790789 if ( child !== null ) {
791- current_effect = child ;
790+ effect = child ;
792791 continue ;
793792 }
794793 }
795794
796- if ( sibling === null ) {
797- let parent = current_effect . parent ;
795+ var parent = effect . parent ;
796+ effect = effect . next ;
798797
799- while ( parent !== null ) {
800- if ( effect === parent ) {
801- break main_loop;
802- }
803- var parent_sibling = parent . next ;
804- if ( parent_sibling !== null ) {
805- current_effect = parent_sibling ;
806- continue main_loop;
807- }
808- parent = parent . parent ;
809- }
798+ while ( effect === null && parent !== null ) {
799+ effect = parent . next ;
800+ parent = parent . parent ;
810801 }
811-
812- current_effect = sibling ;
813802 }
814803
815804 return effects ;
0 commit comments