svelte 5.55.9 → 5.55.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/index.js +1 -1
- package/package.json +2 -2
- package/src/compiler/phases/2-analyze/visitors/AwaitExpression.js +1 -2
- package/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/RegularElement.js +2 -2
- package/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js +2 -9
- package/src/compiler/phases/3-transform/client/visitors/shared/utils.js +1 -1
- package/src/compiler/phases/nodes.js +2 -2
- package/src/compiler/warnings.js +6 -5
- package/src/internal/client/dom/blocks/branches.js +2 -0
- package/src/internal/client/dom/blocks/svelte-element.js +5 -3
- package/src/internal/client/dom/elements/events.js +5 -10
- package/src/internal/client/reactivity/async.js +4 -4
- package/src/internal/client/reactivity/batch.js +70 -57
- package/src/internal/client/reactivity/deriveds.js +7 -4
- package/src/internal/client/reactivity/effects.js +5 -2
- package/src/version.js +1 -1
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "svelte",
|
|
3
3
|
"description": "Cybernetically enhanced web apps",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "5.55.
|
|
5
|
+
"version": "5.55.10",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"engines": {
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"zimmerframe": "^1.1.2"
|
|
174
174
|
},
|
|
175
175
|
"scripts": {
|
|
176
|
-
"build": "rollup -c && pnpm generate",
|
|
176
|
+
"build": "rollup -c && pnpm generate && node scripts/check-treeshakeability.js",
|
|
177
177
|
"dev": "node scripts/process-messages -w & rollup -cw",
|
|
178
178
|
"check": "tsc --project tsconfig.runtime.json && tsc && cd ./tests/types && tsc",
|
|
179
179
|
"check:tsgo": "tsgo --project tsconfig.runtime.json --skipLibCheck && tsgo --skipLibCheck",
|
|
@@ -115,8 +115,7 @@ function is_last_evaluated_expression(path, node) {
|
|
|
115
115
|
break;
|
|
116
116
|
|
|
117
117
|
case 'MemberExpression':
|
|
118
|
-
|
|
119
|
-
break;
|
|
118
|
+
return false;
|
|
120
119
|
|
|
121
120
|
case 'ObjectExpression':
|
|
122
121
|
if (node !== parent.properties.at(-1)) return false;
|
|
@@ -302,7 +302,7 @@ export function check_element(node, context) {
|
|
|
302
302
|
const has_key_event =
|
|
303
303
|
handlers.has('keydown') || handlers.has('keyup') || handlers.has('keypress');
|
|
304
304
|
if (!has_key_event) {
|
|
305
|
-
w.a11y_click_events_have_key_events(node);
|
|
305
|
+
w.a11y_click_events_have_key_events(node, node.name);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
}
|
|
@@ -201,8 +201,8 @@ export function RegularElement(node, context) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// Let bindings first, they can be used on attributes
|
|
205
|
-
context.state.
|
|
204
|
+
// Let bindings first, they can be used on attributes and `{@const}` declarations
|
|
205
|
+
context.state.let_directives.push(...lets);
|
|
206
206
|
|
|
207
207
|
const node_id = context.state.node;
|
|
208
208
|
|
|
@@ -194,11 +194,6 @@ export function VariableDeclaration(node, context) {
|
|
|
194
194
|
/** @type {CallExpression} */ (init)
|
|
195
195
|
);
|
|
196
196
|
|
|
197
|
-
// for now, only wrap async derived in $.save if it's not
|
|
198
|
-
// a top-level instance derived. TODO in future maybe we
|
|
199
|
-
// can dewaterfall all of them?
|
|
200
|
-
const should_save = context.state.is_instance && context.state.scope.function_depth > 1;
|
|
201
|
-
|
|
202
197
|
if (declarator.id.type === 'Identifier') {
|
|
203
198
|
let expression = /** @type {Expression} */ (context.visit(value));
|
|
204
199
|
|
|
@@ -213,9 +208,7 @@ export function VariableDeclaration(node, context) {
|
|
|
213
208
|
location ? b.literal(location) : undefined
|
|
214
209
|
);
|
|
215
210
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
declarations.push(b.declarator(declarator.id, call));
|
|
211
|
+
declarations.push(b.declarator(declarator.id, b.await(call)));
|
|
219
212
|
} else {
|
|
220
213
|
if (rune === '$derived') expression = b.thunk(expression);
|
|
221
214
|
|
|
@@ -251,7 +244,7 @@ export function VariableDeclaration(node, context) {
|
|
|
251
244
|
location ? b.literal(location) : undefined
|
|
252
245
|
);
|
|
253
246
|
|
|
254
|
-
call =
|
|
247
|
+
call = b.await(call);
|
|
255
248
|
}
|
|
256
249
|
|
|
257
250
|
declarations.push(b.declarator(id, call));
|
|
@@ -52,7 +52,7 @@ export class Memoizer {
|
|
|
52
52
|
* @param {ExpressionMetadata} metadata
|
|
53
53
|
*/
|
|
54
54
|
check_blockers(metadata) {
|
|
55
|
-
for (const binding of metadata.
|
|
55
|
+
for (const binding of metadata.references) {
|
|
56
56
|
if (binding.blocker) {
|
|
57
57
|
this.#blockers.add(binding.blocker);
|
|
58
58
|
}
|
|
@@ -102,8 +102,8 @@ export class ExpressionMetadata {
|
|
|
102
102
|
if (!this.#blockers) {
|
|
103
103
|
this.#blockers = new Set();
|
|
104
104
|
|
|
105
|
-
for (const
|
|
106
|
-
if (
|
|
105
|
+
for (const r of this.references) {
|
|
106
|
+
if (r.blocker) this.#blockers.add(r.blocker);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
package/src/compiler/warnings.js
CHANGED
|
@@ -166,11 +166,12 @@ export function a11y_autofocus(node) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Visible, non-interactive
|
|
169
|
+
* Visible, non-interactive element `<%element%>` with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type="button">` or `<a>` might be more appropriate
|
|
170
170
|
* @param {null | NodeLike} node
|
|
171
|
+
* @param {string} element
|
|
171
172
|
*/
|
|
172
|
-
export function a11y_click_events_have_key_events(node) {
|
|
173
|
-
w(node, 'a11y_click_events_have_key_events', `Visible, non-interactive
|
|
173
|
+
export function a11y_click_events_have_key_events(node, element) {
|
|
174
|
+
w(node, 'a11y_click_events_have_key_events', `Visible, non-interactive element \`<${element}>\` with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as \`<button type="button">\` or \`<a>\` might be more appropriate\nhttps://svelte.dev/e/a11y_click_events_have_key_events`);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
/**
|
|
@@ -803,11 +804,11 @@ export function script_context_deprecated(node) {
|
|
|
803
804
|
}
|
|
804
805
|
|
|
805
806
|
/**
|
|
806
|
-
*
|
|
807
|
+
* Unrecognised attribute — should be one of `generics`, `lang` or `module`. If this exists for a preprocessor, ensure that the preprocessor removes it
|
|
807
808
|
* @param {null | NodeLike} node
|
|
808
809
|
*/
|
|
809
810
|
export function script_unknown_attribute(node) {
|
|
810
|
-
w(node, 'script_unknown_attribute', `
|
|
811
|
+
w(node, 'script_unknown_attribute', `Unrecognised attribute — should be one of \`generics\`, \`lang\` or \`module\`. If this exists for a preprocessor, ensure that the preprocessor removes it\nhttps://svelte.dev/e/script_unknown_attribute`);
|
|
811
812
|
}
|
|
812
813
|
|
|
813
814
|
/**
|
|
@@ -90,6 +90,8 @@ export class BranchManager {
|
|
|
90
90
|
var offscreen = this.#offscreen.get(key);
|
|
91
91
|
|
|
92
92
|
if (offscreen) {
|
|
93
|
+
// effect could have been outro'ed before through a prior batch — resume if necessary
|
|
94
|
+
resume_effect(offscreen.effect);
|
|
93
95
|
this.#onscreen.set(key, offscreen.effect);
|
|
94
96
|
this.#offscreen.delete(key);
|
|
95
97
|
|
|
@@ -88,9 +88,11 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
88
88
|
assign_nodes(element, element);
|
|
89
89
|
|
|
90
90
|
if (render_fn) {
|
|
91
|
+
var tmp_comment = null;
|
|
92
|
+
|
|
91
93
|
if (hydrating && is_raw_text_element(next_tag)) {
|
|
92
|
-
// prevent hydration glitches
|
|
93
|
-
element.append(document.createComment(''));
|
|
94
|
+
// prevent hydration glitches (code just below expects an anchor)
|
|
95
|
+
element.append((tmp_comment = document.createComment('')));
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
// If hydrating, use the existing ssr comment as the anchor so that the
|
|
@@ -114,7 +116,7 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
114
116
|
// contains children, it's a user error (which is warned on elsewhere)
|
|
115
117
|
// and the DOM will be silently discarded
|
|
116
118
|
render_fn(element, child_anchor);
|
|
117
|
-
|
|
119
|
+
tmp_comment?.remove();
|
|
118
120
|
set_animation_effect_override(null);
|
|
119
121
|
}
|
|
120
122
|
|
|
@@ -257,12 +257,7 @@ export function handle_event_propagation(event) {
|
|
|
257
257
|
var other_errors = [];
|
|
258
258
|
|
|
259
259
|
while (current_target !== null) {
|
|
260
|
-
|
|
261
|
-
var parent_element =
|
|
262
|
-
current_target.assignedSlot ||
|
|
263
|
-
current_target.parentNode ||
|
|
264
|
-
/** @type {any} */ (current_target).host ||
|
|
265
|
-
null;
|
|
260
|
+
if (current_target === handler_element) break;
|
|
266
261
|
|
|
267
262
|
try {
|
|
268
263
|
// @ts-expect-error
|
|
@@ -284,10 +279,10 @@ export function handle_event_propagation(event) {
|
|
|
284
279
|
throw_error = error;
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
|
-
if (event.cancelBubble
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
current_target =
|
|
282
|
+
if (event.cancelBubble) break;
|
|
283
|
+
|
|
284
|
+
path_idx++;
|
|
285
|
+
current_target = path_idx < path.length ? /** @type {Element} */ (path[path_idx]) : null;
|
|
291
286
|
}
|
|
292
287
|
|
|
293
288
|
if (throw_error) {
|
|
@@ -352,15 +352,15 @@ export function wait(blockers) {
|
|
|
352
352
|
*/
|
|
353
353
|
export function increment_pending() {
|
|
354
354
|
var effect = /** @type {Effect} */ (active_effect);
|
|
355
|
-
var boundary =
|
|
355
|
+
var boundary = effect.b; // undefined if called outside the render tree, e.g. a standalone $effect.root
|
|
356
356
|
var batch = /** @type {Batch} */ (current_batch);
|
|
357
|
-
var blocking = boundary
|
|
357
|
+
var blocking = !!boundary?.is_rendered();
|
|
358
358
|
|
|
359
|
-
boundary
|
|
359
|
+
boundary?.update_pending_count(1, batch);
|
|
360
360
|
batch.increment(blocking, effect);
|
|
361
361
|
|
|
362
362
|
return () => {
|
|
363
|
-
boundary
|
|
363
|
+
boundary?.update_pending_count(-1, batch);
|
|
364
364
|
batch.decrement(blocking, effect);
|
|
365
365
|
};
|
|
366
366
|
}
|
|
@@ -127,13 +127,6 @@ export class Batch {
|
|
|
127
127
|
*/
|
|
128
128
|
previous = new Map();
|
|
129
129
|
|
|
130
|
-
/**
|
|
131
|
-
* Async effects which this batch doesn't take into account anymore when calculating blockers,
|
|
132
|
-
* as it has a value for it already.
|
|
133
|
-
* @type {Set<Effect>}
|
|
134
|
-
*/
|
|
135
|
-
unblocked = new Set();
|
|
136
|
-
|
|
137
130
|
/**
|
|
138
131
|
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
139
132
|
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
@@ -214,6 +207,18 @@ export class Batch {
|
|
|
214
207
|
|
|
215
208
|
#decrement_queued = false;
|
|
216
209
|
|
|
210
|
+
constructor() {
|
|
211
|
+
// link batch
|
|
212
|
+
if (last_batch === null) {
|
|
213
|
+
first_batch = last_batch = this;
|
|
214
|
+
} else {
|
|
215
|
+
last_batch.#next = this;
|
|
216
|
+
this.#prev = last_batch;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
last_batch = this;
|
|
220
|
+
}
|
|
221
|
+
|
|
217
222
|
#is_deferred() {
|
|
218
223
|
if (this.is_fork) return true;
|
|
219
224
|
|
|
@@ -289,19 +294,19 @@ export class Batch {
|
|
|
289
294
|
}
|
|
290
295
|
}
|
|
291
296
|
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
if
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
// We always reschedule previously-deferred effects, not just when
|
|
298
|
+
// #is_deferred() is true, because traversing the tree could make
|
|
299
|
+
// an if block that contains the last blocking pending effect falsy,
|
|
300
|
+
// causing the block to no longer be deferred.
|
|
301
|
+
for (const e of this.#dirty_effects) {
|
|
302
|
+
this.#maybe_dirty_effects.delete(e);
|
|
303
|
+
set_signal_status(e, DIRTY);
|
|
304
|
+
this.schedule(e);
|
|
305
|
+
}
|
|
300
306
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
307
|
+
for (const e of this.#maybe_dirty_effects) {
|
|
308
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
309
|
+
this.schedule(e);
|
|
305
310
|
}
|
|
306
311
|
|
|
307
312
|
const roots = this.#roots;
|
|
@@ -326,6 +331,12 @@ export class Batch {
|
|
|
326
331
|
this.#traverse(root, effects, render_effects);
|
|
327
332
|
} catch (e) {
|
|
328
333
|
reset_all(root);
|
|
334
|
+
// If there's no async work left, this branch is now dead and needs
|
|
335
|
+
// to be discarded to not become a zombie that is never cleaned up.
|
|
336
|
+
// See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414
|
|
337
|
+
// for a (non-minimal) reproduction that demonstrates a case where this is necessary
|
|
338
|
+
// to not get follow-up false-positives via "batch has scheduled roots" invariant errors.
|
|
339
|
+
if (!this.#is_deferred()) this.discard();
|
|
329
340
|
throw e;
|
|
330
341
|
}
|
|
331
342
|
}
|
|
@@ -362,6 +373,10 @@ export class Batch {
|
|
|
362
373
|
const earlier_batch = this.#find_earlier_batch();
|
|
363
374
|
|
|
364
375
|
if (earlier_batch) {
|
|
376
|
+
// If this batch collected deferred effects during traversal, they still need
|
|
377
|
+
// to run after being merged into the earlier batch.
|
|
378
|
+
this.#defer_effects(render_effects);
|
|
379
|
+
this.#defer_effects(effects);
|
|
365
380
|
earlier_batch.#merge(this);
|
|
366
381
|
return;
|
|
367
382
|
}
|
|
@@ -383,31 +398,30 @@ export class Batch {
|
|
|
383
398
|
|
|
384
399
|
var next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));
|
|
385
400
|
|
|
386
|
-
if (this
|
|
401
|
+
if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
|
|
387
402
|
this.#unlink();
|
|
388
|
-
}
|
|
389
403
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
404
|
+
// Order matters here - we need to commit and THEN continue flushing new batches, not the other way around,
|
|
405
|
+
// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.
|
|
406
|
+
// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode
|
|
407
|
+
// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed
|
|
408
|
+
if (async_mode_flag) {
|
|
409
|
+
this.#commit();
|
|
410
|
+
// Rebases can activate other batches or null it out, therefore restore the new one here
|
|
411
|
+
current_batch = next_batch;
|
|
412
|
+
}
|
|
398
413
|
}
|
|
399
414
|
|
|
400
415
|
// Edge case: During traversal new branches might create effects that run immediately and set state,
|
|
401
416
|
// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch
|
|
402
417
|
// once more in that case - most of the time this will just clean up dirty branches.
|
|
403
418
|
if (this.#roots.length > 0) {
|
|
404
|
-
if (next_batch
|
|
419
|
+
if (next_batch !== null) {
|
|
420
|
+
const batch = next_batch;
|
|
421
|
+
batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
|
|
422
|
+
} else {
|
|
405
423
|
next_batch = this;
|
|
406
|
-
this.#link();
|
|
407
424
|
}
|
|
408
|
-
|
|
409
|
-
const batch = next_batch;
|
|
410
|
-
batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
|
|
411
425
|
}
|
|
412
426
|
|
|
413
427
|
if (next_batch !== null) {
|
|
@@ -500,9 +514,12 @@ export class Batch {
|
|
|
500
514
|
|
|
501
515
|
for (const [effect, deferred] of batch.async_deriveds) {
|
|
502
516
|
const d = this.async_deriveds.get(effect);
|
|
503
|
-
if (d) deferred.promise.then(d.resolve);
|
|
517
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
504
518
|
}
|
|
505
519
|
|
|
520
|
+
// Mark is not guaranteed not touch these, so we transfer them
|
|
521
|
+
this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
|
|
522
|
+
|
|
506
523
|
/**
|
|
507
524
|
* mark all effects that depend on `batch.current`, except the
|
|
508
525
|
* async effects that we just resolved (TODO unless they depend
|
|
@@ -620,6 +637,7 @@ export class Batch {
|
|
|
620
637
|
this.#fork_commit_callbacks.clear();
|
|
621
638
|
|
|
622
639
|
this.#unlink();
|
|
640
|
+
this.#deferred?.resolve();
|
|
623
641
|
}
|
|
624
642
|
|
|
625
643
|
/**
|
|
@@ -630,8 +648,6 @@ export class Batch {
|
|
|
630
648
|
}
|
|
631
649
|
|
|
632
650
|
#commit() {
|
|
633
|
-
this.#unlink();
|
|
634
|
-
|
|
635
651
|
// If there are other pending batches, they now need to be 'rebased' —
|
|
636
652
|
// in other words, we re-run block/async effects with the newly
|
|
637
653
|
// committed state, unless the batch in question has a more
|
|
@@ -664,14 +680,16 @@ export class Batch {
|
|
|
664
680
|
// immediately resolving them? Likely not because of how this.apply() works.
|
|
665
681
|
for (const [effect, deferred] of this.async_deriveds) {
|
|
666
682
|
const d = batch.async_deriveds.get(effect);
|
|
667
|
-
if (d) deferred.promise.then(d.resolve);
|
|
683
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
668
684
|
}
|
|
669
685
|
}
|
|
670
686
|
|
|
671
687
|
if (!batch.#started) continue;
|
|
672
688
|
|
|
673
|
-
// Re-run async/block effects that depend on distinct values changed in both batches
|
|
674
|
-
var others = [...batch.current.keys()].filter(
|
|
689
|
+
// Re-run async/block effects that depend on distinct values changed in both batches (ignoring deriveds)
|
|
690
|
+
var others = [...batch.current.keys()].filter(
|
|
691
|
+
(s) => !(/** @type {[any, boolean]} */ (batch.current.get(s))[1]) && !this.current.has(s)
|
|
692
|
+
);
|
|
675
693
|
|
|
676
694
|
if (others.length === 0) {
|
|
677
695
|
if (is_earlier) {
|
|
@@ -711,11 +729,14 @@ export class Batch {
|
|
|
711
729
|
}
|
|
712
730
|
|
|
713
731
|
checked = new Map();
|
|
714
|
-
var current_unequal = [...batch.current
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
732
|
+
var current_unequal = [...batch.current]
|
|
733
|
+
.filter(([c, v1]) => {
|
|
734
|
+
const v2 = this.current.get(c);
|
|
735
|
+
if (!v2) return true;
|
|
736
|
+
// Either their values are different or one is a derived but not the other
|
|
737
|
+
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
738
|
+
})
|
|
739
|
+
.map(([c]) => c);
|
|
719
740
|
|
|
720
741
|
if (current_unequal.length > 0) {
|
|
721
742
|
for (const effect of this.#new_effects) {
|
|
@@ -836,7 +857,6 @@ export class Batch {
|
|
|
836
857
|
static ensure() {
|
|
837
858
|
if (current_batch === null) {
|
|
838
859
|
const batch = (current_batch = new Batch());
|
|
839
|
-
batch.#link();
|
|
840
860
|
|
|
841
861
|
if (!is_processing && !is_flushing_sync) {
|
|
842
862
|
queue_micro_task(() => {
|
|
@@ -956,18 +976,11 @@ export class Batch {
|
|
|
956
976
|
this.#roots.push(e);
|
|
957
977
|
}
|
|
958
978
|
|
|
959
|
-
#link() {
|
|
960
|
-
if (last_batch === null) {
|
|
961
|
-
first_batch = last_batch = this;
|
|
962
|
-
} else {
|
|
963
|
-
last_batch.#next = this;
|
|
964
|
-
this.#prev = last_batch;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
last_batch = this;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
979
|
#unlink() {
|
|
980
|
+
// #merge calls #unlink, discard later on does it again - prevent
|
|
981
|
+
// running it multiple times to not corrupt the linked list
|
|
982
|
+
if (!this.linked) return;
|
|
983
|
+
|
|
971
984
|
var prev = this.#prev;
|
|
972
985
|
var next = this.#next;
|
|
973
986
|
|
|
@@ -187,7 +187,10 @@ export function async_derived(fn, label, location) {
|
|
|
187
187
|
var decrement_pending = increment_pending();
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
if (
|
|
190
|
+
if (
|
|
191
|
+
// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree
|
|
192
|
+
parent.b?.is_rendered()
|
|
193
|
+
) {
|
|
191
194
|
batch.async_deriveds.get(effect)?.reject(OBSOLETE);
|
|
192
195
|
} else {
|
|
193
196
|
// While the boundary is still showing pending, a new run supersedes all older in-flight runs
|
|
@@ -227,9 +230,7 @@ export function async_derived(fn, label, location) {
|
|
|
227
230
|
signal.f ^= ERROR_VALUE;
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (DEV && location !== undefined) {
|
|
233
|
+
if (DEV && location !== undefined && !signal.equals(value)) {
|
|
233
234
|
recent_async_deriveds.add(signal);
|
|
234
235
|
|
|
235
236
|
setTimeout(() => {
|
|
@@ -239,6 +240,8 @@ export function async_derived(fn, label, location) {
|
|
|
239
240
|
}
|
|
240
241
|
});
|
|
241
242
|
}
|
|
243
|
+
|
|
244
|
+
internal_set(signal, value);
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
batch.deactivate();
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
EFFECT,
|
|
21
21
|
DESTROYED,
|
|
22
22
|
INERT,
|
|
23
|
-
REACTION_RAN,
|
|
24
23
|
BLOCK_EFFECT,
|
|
25
24
|
ROOT_EFFECT,
|
|
26
25
|
EFFECT_TRANSPARENT,
|
|
@@ -213,7 +212,11 @@ export function user_effect(fn) {
|
|
|
213
212
|
// Non-nested `$effect(...)` in a component should be deferred
|
|
214
213
|
// until the component is mounted
|
|
215
214
|
var flags = /** @type {Effect} */ (active_effect).f;
|
|
216
|
-
var defer =
|
|
215
|
+
var defer =
|
|
216
|
+
!active_reaction &&
|
|
217
|
+
(flags & BRANCH_EFFECT) !== 0 &&
|
|
218
|
+
component_context !== null &&
|
|
219
|
+
!component_context.i;
|
|
217
220
|
|
|
218
221
|
if (defer) {
|
|
219
222
|
// Top-level `$effect(...)` in an unmounted component — defer until mount
|
package/src/version.js
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -273,6 +273,6 @@
|
|
|
273
273
|
null,
|
|
274
274
|
null
|
|
275
275
|
],
|
|
276
|
-
"mappings": ";;;;;;;;;kBAUiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmC/BC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwEhBC,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;kBAwBbC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCbC,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;;aAwBrBC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA6BdC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;kBAuBRC,OAAOA;;;;;;;;;;;;;;;;kBAgBPC,eAAeA;;;;;;;;;;;;;;;;aAgBpBC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA+CPC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCzSLC,cAAcA;;;;;;;;;;;;iBAsBdC,OAAOA;;;;;;;;iBAwBPC,SAASA;;;;;;;;;;;;;;;;;;;;;;iBA0CTC,qBAAqBA;;;;;;;;;;iBA2CrBC,YAAYA;;;;;;;;;;iBAuBZC,WAAWA;iBClNXC,UAAUA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