svelte 5.45.0 → 5.45.1

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/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.45.0",
5
+ "version": "5.45.1",
6
6
  "type": "module",
7
7
  "types": "./types/index.d.ts",
8
8
  "engines": {
@@ -507,6 +507,8 @@ function reconcile(state, array, anchor, flags, get_key) {
507
507
  current = item.next;
508
508
  }
509
509
 
510
+ let has_offscreen_items = items.size > length;
511
+
510
512
  if (current !== null || seen !== undefined) {
511
513
  var to_destroy = seen === undefined ? [] : array_from(seen);
512
514
 
@@ -520,6 +522,8 @@ function reconcile(state, array, anchor, flags, get_key) {
520
522
 
521
523
  var destroy_length = to_destroy.length;
522
524
 
525
+ has_offscreen_items = items.size - destroy_length > length;
526
+
523
527
  if (destroy_length > 0) {
524
528
  var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
525
529
 
@@ -537,6 +541,18 @@ function reconcile(state, array, anchor, flags, get_key) {
537
541
  }
538
542
  }
539
543
 
544
+ // Append offscreen items at the end
545
+ if (has_offscreen_items) {
546
+ for (const item of items.values()) {
547
+ if (!item.o) {
548
+ link(state, prev, item);
549
+ prev = item;
550
+ }
551
+ }
552
+ }
553
+
554
+ state.effect.last = prev && prev.e;
555
+
540
556
  if (is_animated) {
541
557
  queue_micro_task(() => {
542
558
  if (to_animate === undefined) return;
@@ -641,10 +657,6 @@ function link(state, prev, next) {
641
657
  state.first = next;
642
658
  state.effect.first = next && next.e;
643
659
  } else {
644
- if (prev.e === state.effect.last && next !== null) {
645
- state.effect.last = next.e;
646
- }
647
-
648
660
  if (prev.e.next) {
649
661
  prev.e.next.prev = null;
650
662
  }
@@ -653,13 +665,7 @@ function link(state, prev, next) {
653
665
  prev.e.next = next && next.e;
654
666
  }
655
667
 
656
- if (next === null) {
657
- state.effect.last = prev && prev.e;
658
- } else {
659
- if (next.e === state.effect.last && prev === null) {
660
- state.effect.last = next.e.prev;
661
- }
662
-
668
+ if (next !== null) {
663
669
  if (next.e.prev) {
664
670
  next.e.prev.next = null;
665
671
  }
package/src/version.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * The current version, as set in package.json.
5
5
  * @type {string}
6
6
  */
7
- export const VERSION = '5.45.0';
7
+ export const VERSION = '5.45.1';
8
8
  export const PUBLIC_VERSION = '5';