|
1 | 1 | import { add_render_callback, flush, schedule_update, dirty_components } from './scheduler';
|
2 |
| -import { current_component, set_current_component } from './lifecycle'; |
| 2 | +import { current_component, no_current_component, set_current_component } from './lifecycle'; |
3 | 3 | import { blank_object, is_empty, is_function, run, run_all, noop } from './utils';
|
4 | 4 | import { children, detach, start_hydrating, end_hydrating } from './dom';
|
5 | 5 | import { transition_in } from './transitions';
|
@@ -152,26 +152,29 @@ export function init(component, options, instance, create_fragment, not_equal, p
|
152 | 152 | ready = true;
|
153 | 153 | run_all($$.before_update);
|
154 | 154 |
|
155 |
| - // `false` as a special case of no DOM component |
156 |
| - $$.fragment = create_fragment ? create_fragment($$.ctx) : false; |
157 |
| - |
158 |
| - if (options.target) { |
159 |
| - if (options.hydrate) { |
160 |
| - start_hydrating(); |
161 |
| - const nodes = children(options.target); |
162 |
| - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
163 |
| - $$.fragment && $$.fragment!.l(nodes); |
164 |
| - nodes.forEach(detach); |
165 |
| - } else { |
166 |
| - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
167 |
| - $$.fragment && $$.fragment!.c(); |
168 |
| - } |
| 155 | + no_current_component(() => { |
| 156 | + // `false` as a special case of no DOM component |
| 157 | + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; |
| 158 | + |
| 159 | + |
| 160 | + if (options.target) { |
| 161 | + if (options.hydrate) { |
| 162 | + start_hydrating(); |
| 163 | + const nodes = children(options.target); |
| 164 | + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 165 | + $$.fragment && $$.fragment!.l(nodes); |
| 166 | + nodes.forEach(detach); |
| 167 | + } else { |
| 168 | + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 169 | + $$.fragment && $$.fragment!.c(); |
| 170 | + } |
169 | 171 |
|
170 |
| - if (options.intro) transition_in(component.$$.fragment); |
171 |
| - mount_component(component, options.target, options.anchor, options.customElement); |
172 |
| - end_hydrating(); |
173 |
| - flush(); |
174 |
| - } |
| 172 | + if (options.intro) transition_in(component.$$.fragment); |
| 173 | + mount_component(component, options.target, options.anchor, options.customElement); |
| 174 | + end_hydrating(); |
| 175 | + flush(); |
| 176 | + } |
| 177 | + }); |
175 | 178 |
|
176 | 179 | set_current_component(parent_component);
|
177 | 180 | }
|
|
0 commit comments