@jsenv/navi 0.29.448 → 0.29.449
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/dev/jsenv_navi.js +92 -54
- package/dist/dev/jsenv_navi.js.map +3 -3
- package/dist/jsenv_navi.js +92 -54
- package/dist/jsenv_navi.js.map +3 -3
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -4827,9 +4827,11 @@ const actionRunEffect = (
|
|
|
4827
4827
|
return params;
|
|
4828
4828
|
});
|
|
4829
4829
|
// Whether the getter asks for a run is read off what it returned, never off
|
|
4830
|
-
// the
|
|
4831
|
-
//
|
|
4832
|
-
//
|
|
4830
|
+
// the instances it moves between: an action handed here holding params of
|
|
4831
|
+
// its own (an instance, a binding) keeps them when the getter returns
|
|
4832
|
+
// nothing — and nothing must still run nothing; an instance reset under the
|
|
4833
|
+
// effect (a same-resource DELETE) reads as never run — and the next params
|
|
4834
|
+
// the getter asks for must still run.
|
|
4833
4835
|
let asking = Boolean(actionParamsSignal.peek());
|
|
4834
4836
|
const actionRunnedByThisEffect = action.bindParams(actionParamsSignal, {
|
|
4835
4837
|
debounce,
|
|
@@ -4856,11 +4858,7 @@ const actionRunEffect = (
|
|
|
4856
4858
|
return;
|
|
4857
4859
|
}
|
|
4858
4860
|
|
|
4859
|
-
if (
|
|
4860
|
-
actionTargetPrevious &&
|
|
4861
|
-
!actionTargetPrevious.isPrerun &&
|
|
4862
|
-
actionTarget
|
|
4863
|
-
) {
|
|
4861
|
+
if (actionTargetPrevious && actionTarget) {
|
|
4864
4862
|
// params changed
|
|
4865
4863
|
if (!asking) {
|
|
4866
4864
|
// falsy params, don't run
|
|
@@ -78976,6 +78974,68 @@ const useItemStore = ({
|
|
|
78976
78974
|
if (staleRanksRef.current === null) {
|
|
78977
78975
|
staleRanksRef.current = restored ? new Set(pages.byIndex.keys()) : new Set();
|
|
78978
78976
|
}
|
|
78977
|
+
const takeInPage = ({
|
|
78978
|
+
pageItems,
|
|
78979
|
+
pageStart,
|
|
78980
|
+
pageCount
|
|
78981
|
+
}) => {
|
|
78982
|
+
// An item from before is gone from where it stood when the page puts
|
|
78983
|
+
// it at another rank (it would be drawn twice), or when its rank is
|
|
78984
|
+
// past the end of the collection.
|
|
78985
|
+
const staleRanks = staleRanksRef.current;
|
|
78986
|
+
const pageEnd = pageStart + pageItems.length;
|
|
78987
|
+
let dropped = false;
|
|
78988
|
+
if (staleRanks.size > 0) {
|
|
78989
|
+
const pageIds = new Set();
|
|
78990
|
+
for (const pageItem of pageItems) {
|
|
78991
|
+
if (pageItem && pageItem.id !== undefined) {
|
|
78992
|
+
pageIds.add(pageItem.id);
|
|
78993
|
+
}
|
|
78994
|
+
}
|
|
78995
|
+
for (const rank of staleRanks) {
|
|
78996
|
+
if (rank >= pageStart && rank < pageEnd) {
|
|
78997
|
+
continue;
|
|
78998
|
+
}
|
|
78999
|
+
const staleItem = pages.byIndex.get(rank);
|
|
79000
|
+
if (rank >= pageCount || staleItem && pageIds.has(staleItem.id)) {
|
|
79001
|
+
staleRanks.delete(rank);
|
|
79002
|
+
pages.byIndex.delete(rank);
|
|
79003
|
+
dropped = true;
|
|
79004
|
+
}
|
|
79005
|
+
}
|
|
79006
|
+
}
|
|
79007
|
+
let i = 0;
|
|
79008
|
+
while (i < pageItems.length) {
|
|
79009
|
+
pages.byIndex.set(pageStart + i, pageItems[i]);
|
|
79010
|
+
staleRanks.delete(pageStart + i);
|
|
79011
|
+
i++;
|
|
79012
|
+
}
|
|
79013
|
+
pages.count = pageCount;
|
|
79014
|
+
// Which rank holds which id, kept by the source so a list drawing
|
|
79015
|
+
// this collection again finds it drawn (see readComposition above).
|
|
79016
|
+
if (itemsAction.writeComposition) {
|
|
79017
|
+
itemsAction.writeComposition({
|
|
79018
|
+
byIndex: pages.byIndex,
|
|
79019
|
+
count: pageCount,
|
|
79020
|
+
replace: dropped
|
|
79021
|
+
});
|
|
79022
|
+
}
|
|
79023
|
+
};
|
|
79024
|
+
// The pages answered since the last render, taken in by the render and not
|
|
79025
|
+
// as they land: what the list reads of the run — how many items it stands for
|
|
79026
|
+
// (see listItems.take), where an item sits (its locator) — then moves in one
|
|
79027
|
+
// step. Taken in on landing, an item could be located past the count the list
|
|
79028
|
+
// still holds, and a list held on it would aim its window there at every
|
|
79029
|
+
// render, framed back each time.
|
|
79030
|
+
const pagesLandedRef = useRef([]);
|
|
79031
|
+
const pagesLanded = pagesLandedRef.current;
|
|
79032
|
+
const pagesTakenIn = pagesLanded.length > 0;
|
|
79033
|
+
if (pagesTakenIn) {
|
|
79034
|
+
pagesLandedRef.current = [];
|
|
79035
|
+
for (const page of pagesLanded) {
|
|
79036
|
+
takeInPage(page);
|
|
79037
|
+
}
|
|
79038
|
+
}
|
|
78979
79039
|
const [refreshing, setRefreshing] = useState(false);
|
|
78980
79040
|
// A source that says when what it reads has moved (a resource range reader
|
|
78981
79041
|
// does: see rerunOn.GET_RANGE) is heard here — a write deciding who belongs
|
|
@@ -79006,13 +79066,18 @@ const useItemStore = ({
|
|
|
79006
79066
|
const [failure, setFailure] = useState(null);
|
|
79007
79067
|
const listItems = useContext(ListItemsContext);
|
|
79008
79068
|
// The items are there, which is what the list waits for to place itself on the
|
|
79009
|
-
// item it is held at (see placeWhereHeld). Said from an effect
|
|
79010
|
-
// during this very render must not be written
|
|
79069
|
+
// item it is held at (see placeWhereHeld). Said from an effect, once the run
|
|
79070
|
+
// has drawn them: a signal read during this very render must not be written
|
|
79071
|
+
// during it.
|
|
79011
79072
|
useLayoutEffect(() => {
|
|
79012
|
-
if (
|
|
79073
|
+
if (inMemory) {
|
|
79074
|
+
if (itemsHeldRef.current) {
|
|
79075
|
+
return;
|
|
79076
|
+
}
|
|
79077
|
+
itemsHeldRef.current = true;
|
|
79078
|
+
} else if (!pagesTakenIn) {
|
|
79013
79079
|
return;
|
|
79014
79080
|
}
|
|
79015
|
-
itemsHeldRef.current = true;
|
|
79016
79081
|
listItems.pagesSignal.value = listItems.pagesSignal.peek() + 1;
|
|
79017
79082
|
});
|
|
79018
79083
|
// Before the first answer a run does not know how many items it stands for.
|
|
@@ -79084,8 +79149,11 @@ const useItemStore = ({
|
|
|
79084
79149
|
};
|
|
79085
79150
|
// A list taken off the screen while it was asking leaves nothing ringing
|
|
79086
79151
|
// behind it: whoever is drawing "looking for items" has to stop.
|
|
79152
|
+
const mountedRef = useRef(false);
|
|
79087
79153
|
useLayoutEffect(() => {
|
|
79154
|
+
mountedRef.current = true;
|
|
79088
79155
|
return () => {
|
|
79156
|
+
mountedRef.current = false;
|
|
79089
79157
|
if (requestStateRef.current.busy && onRequestStateChangeRef.current) {
|
|
79090
79158
|
onRequestStateChangeRef.current({
|
|
79091
79159
|
busy: false,
|
|
@@ -79347,51 +79415,21 @@ const useItemStore = ({
|
|
|
79347
79415
|
const pageItems = Array.isArray(page) ? page : page.items;
|
|
79348
79416
|
const pageStart = Array.isArray(page) ? 0 : page.start ?? 0;
|
|
79349
79417
|
const pageCount = Array.isArray(page) ? pageItems.length : page.count ?? pageStart + pageItems.length;
|
|
79418
|
+
const pageLanded = {
|
|
79419
|
+
pageItems,
|
|
79420
|
+
pageStart,
|
|
79421
|
+
pageCount
|
|
79422
|
+
};
|
|
79423
|
+
if (!mountedRef.current) {
|
|
79424
|
+
// No render is coming to take it in, and the source still keeps
|
|
79425
|
+
// what came back for the next list drawing this collection.
|
|
79426
|
+
takeInPage(pageLanded);
|
|
79427
|
+
return;
|
|
79428
|
+
}
|
|
79350
79429
|
// Before the items land: what is on screen has to stay where it is,
|
|
79351
79430
|
// and the DOM still shows the state to hold onto.
|
|
79352
79431
|
listItems.captureAnchor();
|
|
79353
|
-
|
|
79354
|
-
// it at another rank (it would be drawn twice), or when its rank is
|
|
79355
|
-
// past the end of the collection.
|
|
79356
|
-
const staleRanksNow = staleRanksRef.current;
|
|
79357
|
-
const pageEnd = pageStart + pageItems.length;
|
|
79358
|
-
let dropped = false;
|
|
79359
|
-
if (staleRanksNow.size > 0) {
|
|
79360
|
-
const pageIds = new Set();
|
|
79361
|
-
for (const pageItem of pageItems) {
|
|
79362
|
-
if (pageItem && pageItem.id !== undefined) {
|
|
79363
|
-
pageIds.add(pageItem.id);
|
|
79364
|
-
}
|
|
79365
|
-
}
|
|
79366
|
-
for (const rank of staleRanksNow) {
|
|
79367
|
-
if (rank >= pageStart && rank < pageEnd) {
|
|
79368
|
-
continue;
|
|
79369
|
-
}
|
|
79370
|
-
const staleItem = pages.byIndex.get(rank);
|
|
79371
|
-
if (rank >= pageCount || staleItem && pageIds.has(staleItem.id)) {
|
|
79372
|
-
staleRanksNow.delete(rank);
|
|
79373
|
-
pages.byIndex.delete(rank);
|
|
79374
|
-
dropped = true;
|
|
79375
|
-
}
|
|
79376
|
-
}
|
|
79377
|
-
}
|
|
79378
|
-
let i = 0;
|
|
79379
|
-
while (i < pageItems.length) {
|
|
79380
|
-
pages.byIndex.set(pageStart + i, pageItems[i]);
|
|
79381
|
-
staleRanksNow.delete(pageStart + i);
|
|
79382
|
-
i++;
|
|
79383
|
-
}
|
|
79384
|
-
pages.count = pageCount;
|
|
79385
|
-
// Which rank holds which id, kept by the source so a list drawing
|
|
79386
|
-
// this collection again finds it drawn (see readComposition above).
|
|
79387
|
-
if (itemsAction.writeComposition) {
|
|
79388
|
-
itemsAction.writeComposition({
|
|
79389
|
-
byIndex: pages.byIndex,
|
|
79390
|
-
count: pageCount,
|
|
79391
|
-
replace: dropped
|
|
79392
|
-
});
|
|
79393
|
-
}
|
|
79394
|
-
listItems.pagesSignal.value = listItems.pagesSignal.peek() + 1;
|
|
79432
|
+
pagesLandedRef.current.push(pageLanded);
|
|
79395
79433
|
setPageVersion(version => version + 1);
|
|
79396
79434
|
};
|
|
79397
79435
|
const failed = error => {
|