9
9
set_current_reaction
10
10
} from '../../runtime.js' ;
11
11
import { destroy_effect , pause_effect , render_effect } from '../../reactivity/effects.js' ;
12
- import { DESTROYED , INERT } from '../../constants.js' ;
12
+ import { INERT } from '../../constants.js' ;
13
13
14
14
/**
15
15
* @template V
@@ -57,17 +57,6 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
57
57
return effect ;
58
58
}
59
59
60
- /** @param {import('#client').Effect } effect */
61
- function pause ( effect ) {
62
- if ( ( effect . f & DESTROYED ) !== 0 ) return ;
63
- const dom = effect . dom ;
64
-
65
- pause_effect ( effect , ( ) => {
66
- // TODO make this unnecessary
67
- if ( dom !== null ) remove ( dom ) ;
68
- } ) ;
69
- }
70
-
71
60
const branch = render_effect ( ( ) => {
72
61
if ( input === ( input = get_input ( ) ) ) return ;
73
62
@@ -83,30 +72,30 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
83
72
pending_effect = render_effect ( ( ) => pending_fn ( anchor ) , true ) ;
84
73
}
85
74
86
- if ( then_effect ) pause ( then_effect ) ;
87
- if ( catch_effect ) pause ( catch_effect ) ;
75
+ if ( then_effect ) pause_effect ( then_effect ) ;
76
+ if ( catch_effect ) pause_effect ( catch_effect ) ;
88
77
89
78
promise . then (
90
79
( value ) => {
91
80
if ( promise !== input ) return ;
92
- if ( pending_effect ) pause ( pending_effect ) ;
81
+ if ( pending_effect ) pause_effect ( pending_effect ) ;
93
82
94
83
if ( then_fn ) {
95
84
then_effect = create_effect ( then_fn , value ) ;
96
85
}
97
86
} ,
98
87
( error ) => {
99
88
if ( promise !== input ) return ;
100
- if ( pending_effect ) pause ( pending_effect ) ;
89
+ if ( pending_effect ) pause_effect ( pending_effect ) ;
101
90
102
91
if ( catch_fn ) {
103
92
catch_effect = create_effect ( catch_fn , error ) ;
104
93
}
105
94
}
106
95
) ;
107
96
} else {
108
- if ( pending_effect ) pause ( pending_effect ) ;
109
- if ( catch_effect ) pause ( catch_effect ) ;
97
+ if ( pending_effect ) pause_effect ( pending_effect ) ;
98
+ if ( catch_effect ) pause_effect ( catch_effect ) ;
110
99
111
100
if ( then_fn ) {
112
101
if ( then_effect ) {
0 commit comments