Skip to content

Commit e1d7798

Browse files
committed
context is never null in pop
1 parent 26d56b2 commit e1d7798

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

packages/svelte/src/internal/client/context.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,29 +175,28 @@ export function push(props, runes = false, fn) {
175175
* @returns {T}
176176
*/
177177
export function pop(component) {
178-
if (component_context !== null) {
179-
var effects = component_context.e;
178+
var context = /** @type {ComponentContext} */ (component_context);
179+
var effects = context.e;
180180

181-
if (effects !== null) {
182-
component_context.e = null;
181+
if (effects !== null) {
182+
context.e = null;
183183

184-
for (var fn of effects) {
185-
create_user_effect(fn);
186-
}
184+
for (var fn of effects) {
185+
create_user_effect(fn);
187186
}
187+
}
188188

189-
if (component !== undefined) {
190-
component_context.x = component;
191-
}
189+
if (component !== undefined) {
190+
context.x = component;
191+
}
192192

193-
component_context = component_context.p;
193+
component_context = context.p;
194194

195-
if (DEV) {
196-
dev_current_component_function = component_context?.function ?? null;
197-
}
195+
if (DEV) {
196+
dev_current_component_function = component_context?.function ?? null;
198197
}
199198

200-
return component || /** @type {T} */ ({});
199+
return component ?? /** @type {T} */ ({});
201200
}
202201

203202
/** @returns {boolean} */

0 commit comments

Comments
 (0)