@torpor/view 1.2.3 → 1.2.4
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/dist/index.cjs +8 -4
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2274,13 +2274,17 @@ const SHALLOW_WATCH_OPTIONS = { shallow: true };
|
|
|
2274
2274
|
* caller can slot it into the live list. The sibling chain is left for the
|
|
2275
2275
|
* end-of-pass relink.
|
|
2276
2276
|
*/
|
|
2277
|
-
function mountSpec(spec, region, before, create, noWatch) {
|
|
2277
|
+
function mountSpec(spec, region, before, anchor, create, noWatch) {
|
|
2278
2278
|
const item = newListItem(spec.data, spec.key);
|
|
2279
2279
|
const savedActiveRegion = context.activeRegion;
|
|
2280
2280
|
item.depth = region.depth + 1;
|
|
2281
2281
|
context.activeRegion = item;
|
|
2282
2282
|
if (noWatch !== true) item.data = $watch(item.data, SHALLOW_WATCH_OPTIONS);
|
|
2283
|
+
const suspendHydration = context.hydrationNode !== null && context.hydrationNode === anchor;
|
|
2284
|
+
const savedHydrationNode = context.hydrationNode;
|
|
2285
|
+
if (suspendHydration) context.hydrationNode = null;
|
|
2283
2286
|
create(item, before);
|
|
2287
|
+
if (suspendHydration) context.hydrationNode = savedHydrationNode;
|
|
2284
2288
|
context.activeRegion = savedActiveRegion;
|
|
2285
2289
|
return item;
|
|
2286
2290
|
}
|
|
@@ -2349,7 +2353,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2349
2353
|
} else break;
|
|
2350
2354
|
if (oldStart > oldEnd && newStart <= newEnd) {
|
|
2351
2355
|
const before = newEnd + 1 < newSpecs.length ? newItems[newEnd + 1].startNode : anchor;
|
|
2352
|
-
for (let i = newStart; i <= newEnd; i++) newItems[i] = mountSpec(newSpecs[i], region, before, create, noWatch);
|
|
2356
|
+
for (let i = newStart; i <= newEnd; i++) newItems[i] = mountSpec(newSpecs[i], region, before, anchor, create, noWatch);
|
|
2353
2357
|
chainNeedsRelink = true;
|
|
2354
2358
|
} else if (newStart > newEnd) for (let i = oldStart; i <= oldEnd; i++) clearRegion(oldItems[i]);
|
|
2355
2359
|
else {
|
|
@@ -2364,7 +2368,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2364
2368
|
let before = oldItems[oldEnd]?.endNode?.nextSibling ?? anchor;
|
|
2365
2369
|
for (let i = oldEnd; i >= oldStart; i--) clearRegion(oldItems[i]);
|
|
2366
2370
|
for (let i = newStart; i <= newEnd; i++) {
|
|
2367
|
-
newItems[i] = mountSpec(newSpecs[i], region, before, create, noWatch);
|
|
2371
|
+
newItems[i] = mountSpec(newSpecs[i], region, before, anchor, create, noWatch);
|
|
2368
2372
|
before = newItems[i].endNode.nextSibling;
|
|
2369
2373
|
}
|
|
2370
2374
|
chainNeedsRelink = true;
|
|
@@ -2386,7 +2390,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2386
2390
|
const newIdx = newStart + i;
|
|
2387
2391
|
const before = newIdx + 1 < newSpecs.length ? newItems[newIdx + 1].startNode : anchor;
|
|
2388
2392
|
if (newIndexToOld[i] === 0) {
|
|
2389
|
-
newItems[newIdx] = mountSpec(newSpecs[newIdx], region, before, create, noWatch);
|
|
2393
|
+
newItems[newIdx] = mountSpec(newSpecs[newIdx], region, before, anchor, create, noWatch);
|
|
2390
2394
|
chainNeedsRelink = true;
|
|
2391
2395
|
} else if (j < 0 || i !== seq[j]) {
|
|
2392
2396
|
moveRegion(parent, newItems[newIdx], before);
|
package/dist/index.mjs
CHANGED
|
@@ -2273,13 +2273,17 @@ const SHALLOW_WATCH_OPTIONS = { shallow: true };
|
|
|
2273
2273
|
* caller can slot it into the live list. The sibling chain is left for the
|
|
2274
2274
|
* end-of-pass relink.
|
|
2275
2275
|
*/
|
|
2276
|
-
function mountSpec(spec, region, before, create, noWatch) {
|
|
2276
|
+
function mountSpec(spec, region, before, anchor, create, noWatch) {
|
|
2277
2277
|
const item = newListItem(spec.data, spec.key);
|
|
2278
2278
|
const savedActiveRegion = context.activeRegion;
|
|
2279
2279
|
item.depth = region.depth + 1;
|
|
2280
2280
|
context.activeRegion = item;
|
|
2281
2281
|
if (noWatch !== true) item.data = $watch(item.data, SHALLOW_WATCH_OPTIONS);
|
|
2282
|
+
const suspendHydration = context.hydrationNode !== null && context.hydrationNode === anchor;
|
|
2283
|
+
const savedHydrationNode = context.hydrationNode;
|
|
2284
|
+
if (suspendHydration) context.hydrationNode = null;
|
|
2282
2285
|
create(item, before);
|
|
2286
|
+
if (suspendHydration) context.hydrationNode = savedHydrationNode;
|
|
2283
2287
|
context.activeRegion = savedActiveRegion;
|
|
2284
2288
|
return item;
|
|
2285
2289
|
}
|
|
@@ -2348,7 +2352,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2348
2352
|
} else break;
|
|
2349
2353
|
if (oldStart > oldEnd && newStart <= newEnd) {
|
|
2350
2354
|
const before = newEnd + 1 < newSpecs.length ? newItems[newEnd + 1].startNode : anchor;
|
|
2351
|
-
for (let i = newStart; i <= newEnd; i++) newItems[i] = mountSpec(newSpecs[i], region, before, create, noWatch);
|
|
2355
|
+
for (let i = newStart; i <= newEnd; i++) newItems[i] = mountSpec(newSpecs[i], region, before, anchor, create, noWatch);
|
|
2352
2356
|
chainNeedsRelink = true;
|
|
2353
2357
|
} else if (newStart > newEnd) for (let i = oldStart; i <= oldEnd; i++) clearRegion(oldItems[i]);
|
|
2354
2358
|
else {
|
|
@@ -2363,7 +2367,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2363
2367
|
let before = oldItems[oldEnd]?.endNode?.nextSibling ?? anchor;
|
|
2364
2368
|
for (let i = oldEnd; i >= oldStart; i--) clearRegion(oldItems[i]);
|
|
2365
2369
|
for (let i = newStart; i <= newEnd; i++) {
|
|
2366
|
-
newItems[i] = mountSpec(newSpecs[i], region, before, create, noWatch);
|
|
2370
|
+
newItems[i] = mountSpec(newSpecs[i], region, before, anchor, create, noWatch);
|
|
2367
2371
|
before = newItems[i].endNode.nextSibling;
|
|
2368
2372
|
}
|
|
2369
2373
|
chainNeedsRelink = true;
|
|
@@ -2385,7 +2389,7 @@ function runListItems(region, parent, anchor, oldItems, newSpecs, create, update
|
|
|
2385
2389
|
const newIdx = newStart + i;
|
|
2386
2390
|
const before = newIdx + 1 < newSpecs.length ? newItems[newIdx + 1].startNode : anchor;
|
|
2387
2391
|
if (newIndexToOld[i] === 0) {
|
|
2388
|
-
newItems[newIdx] = mountSpec(newSpecs[newIdx], region, before, create, noWatch);
|
|
2392
|
+
newItems[newIdx] = mountSpec(newSpecs[newIdx], region, before, anchor, create, noWatch);
|
|
2389
2393
|
chainNeedsRelink = true;
|
|
2390
2394
|
} else if (j < 0 || i !== seq[j]) {
|
|
2391
2395
|
moveRegion(parent, newItems[newIdx], before);
|