@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/dev/jsenv_navi.js
CHANGED
|
@@ -4988,9 +4988,11 @@ const actionRunEffect = (
|
|
|
4988
4988
|
return params;
|
|
4989
4989
|
});
|
|
4990
4990
|
// Whether the getter asks for a run is read off what it returned, never off
|
|
4991
|
-
// the
|
|
4992
|
-
//
|
|
4993
|
-
//
|
|
4991
|
+
// the instances it moves between: an action handed here holding params of
|
|
4992
|
+
// its own (an instance, a binding) keeps them when the getter returns
|
|
4993
|
+
// nothing — and nothing must still run nothing; an instance reset under the
|
|
4994
|
+
// effect (a same-resource DELETE) reads as never run — and the next params
|
|
4995
|
+
// the getter asks for must still run.
|
|
4994
4996
|
let asking = Boolean(actionParamsSignal.peek());
|
|
4995
4997
|
const actionRunnedByThisEffect = action.bindParams(actionParamsSignal, {
|
|
4996
4998
|
debounce,
|
|
@@ -5017,11 +5019,7 @@ const actionRunEffect = (
|
|
|
5017
5019
|
return;
|
|
5018
5020
|
}
|
|
5019
5021
|
|
|
5020
|
-
if (
|
|
5021
|
-
actionTargetPrevious &&
|
|
5022
|
-
!actionTargetPrevious.isPrerun &&
|
|
5023
|
-
actionTarget
|
|
5024
|
-
) {
|
|
5022
|
+
if (actionTargetPrevious && actionTarget) {
|
|
5025
5023
|
// params changed
|
|
5026
5024
|
if (!asking) {
|
|
5027
5025
|
// falsy params, don't run
|
|
@@ -80557,6 +80555,68 @@ const useItemStore = ({
|
|
|
80557
80555
|
if (staleRanksRef.current === null) {
|
|
80558
80556
|
staleRanksRef.current = restored ? new Set(pages.byIndex.keys()) : new Set();
|
|
80559
80557
|
}
|
|
80558
|
+
const takeInPage = ({
|
|
80559
|
+
pageItems,
|
|
80560
|
+
pageStart,
|
|
80561
|
+
pageCount
|
|
80562
|
+
}) => {
|
|
80563
|
+
// An item from before is gone from where it stood when the page puts
|
|
80564
|
+
// it at another rank (it would be drawn twice), or when its rank is
|
|
80565
|
+
// past the end of the collection.
|
|
80566
|
+
const staleRanks = staleRanksRef.current;
|
|
80567
|
+
const pageEnd = pageStart + pageItems.length;
|
|
80568
|
+
let dropped = false;
|
|
80569
|
+
if (staleRanks.size > 0) {
|
|
80570
|
+
const pageIds = new Set();
|
|
80571
|
+
for (const pageItem of pageItems) {
|
|
80572
|
+
if (pageItem && pageItem.id !== undefined) {
|
|
80573
|
+
pageIds.add(pageItem.id);
|
|
80574
|
+
}
|
|
80575
|
+
}
|
|
80576
|
+
for (const rank of staleRanks) {
|
|
80577
|
+
if (rank >= pageStart && rank < pageEnd) {
|
|
80578
|
+
continue;
|
|
80579
|
+
}
|
|
80580
|
+
const staleItem = pages.byIndex.get(rank);
|
|
80581
|
+
if (rank >= pageCount || staleItem && pageIds.has(staleItem.id)) {
|
|
80582
|
+
staleRanks.delete(rank);
|
|
80583
|
+
pages.byIndex.delete(rank);
|
|
80584
|
+
dropped = true;
|
|
80585
|
+
}
|
|
80586
|
+
}
|
|
80587
|
+
}
|
|
80588
|
+
let i = 0;
|
|
80589
|
+
while (i < pageItems.length) {
|
|
80590
|
+
pages.byIndex.set(pageStart + i, pageItems[i]);
|
|
80591
|
+
staleRanks.delete(pageStart + i);
|
|
80592
|
+
i++;
|
|
80593
|
+
}
|
|
80594
|
+
pages.count = pageCount;
|
|
80595
|
+
// Which rank holds which id, kept by the source so a list drawing
|
|
80596
|
+
// this collection again finds it drawn (see readComposition above).
|
|
80597
|
+
if (itemsAction.writeComposition) {
|
|
80598
|
+
itemsAction.writeComposition({
|
|
80599
|
+
byIndex: pages.byIndex,
|
|
80600
|
+
count: pageCount,
|
|
80601
|
+
replace: dropped
|
|
80602
|
+
});
|
|
80603
|
+
}
|
|
80604
|
+
};
|
|
80605
|
+
// The pages answered since the last render, taken in by the render and not
|
|
80606
|
+
// as they land: what the list reads of the run — how many items it stands for
|
|
80607
|
+
// (see listItems.take), where an item sits (its locator) — then moves in one
|
|
80608
|
+
// step. Taken in on landing, an item could be located past the count the list
|
|
80609
|
+
// still holds, and a list held on it would aim its window there at every
|
|
80610
|
+
// render, framed back each time.
|
|
80611
|
+
const pagesLandedRef = useRef([]);
|
|
80612
|
+
const pagesLanded = pagesLandedRef.current;
|
|
80613
|
+
const pagesTakenIn = pagesLanded.length > 0;
|
|
80614
|
+
if (pagesTakenIn) {
|
|
80615
|
+
pagesLandedRef.current = [];
|
|
80616
|
+
for (const page of pagesLanded) {
|
|
80617
|
+
takeInPage(page);
|
|
80618
|
+
}
|
|
80619
|
+
}
|
|
80560
80620
|
const [refreshing, setRefreshing] = useState(false);
|
|
80561
80621
|
// A source that says when what it reads has moved (a resource range reader
|
|
80562
80622
|
// does: see rerunOn.GET_RANGE) is heard here — a write deciding who belongs
|
|
@@ -80587,13 +80647,18 @@ const useItemStore = ({
|
|
|
80587
80647
|
const [failure, setFailure] = useState(null);
|
|
80588
80648
|
const listItems = useContext(ListItemsContext);
|
|
80589
80649
|
// The items are there, which is what the list waits for to place itself on the
|
|
80590
|
-
// item it is held at (see placeWhereHeld). Said from an effect
|
|
80591
|
-
// during this very render must not be written
|
|
80650
|
+
// item it is held at (see placeWhereHeld). Said from an effect, once the run
|
|
80651
|
+
// has drawn them: a signal read during this very render must not be written
|
|
80652
|
+
// during it.
|
|
80592
80653
|
useLayoutEffect(() => {
|
|
80593
|
-
if (
|
|
80654
|
+
if (inMemory) {
|
|
80655
|
+
if (itemsHeldRef.current) {
|
|
80656
|
+
return;
|
|
80657
|
+
}
|
|
80658
|
+
itemsHeldRef.current = true;
|
|
80659
|
+
} else if (!pagesTakenIn) {
|
|
80594
80660
|
return;
|
|
80595
80661
|
}
|
|
80596
|
-
itemsHeldRef.current = true;
|
|
80597
80662
|
listItems.pagesSignal.value = listItems.pagesSignal.peek() + 1;
|
|
80598
80663
|
});
|
|
80599
80664
|
// Before the first answer a run does not know how many items it stands for.
|
|
@@ -80665,8 +80730,11 @@ const useItemStore = ({
|
|
|
80665
80730
|
};
|
|
80666
80731
|
// A list taken off the screen while it was asking leaves nothing ringing
|
|
80667
80732
|
// behind it: whoever is drawing "looking for items" has to stop.
|
|
80733
|
+
const mountedRef = useRef(false);
|
|
80668
80734
|
useLayoutEffect(() => {
|
|
80735
|
+
mountedRef.current = true;
|
|
80669
80736
|
return () => {
|
|
80737
|
+
mountedRef.current = false;
|
|
80670
80738
|
if (requestStateRef.current.busy && onRequestStateChangeRef.current) {
|
|
80671
80739
|
onRequestStateChangeRef.current({
|
|
80672
80740
|
busy: false,
|
|
@@ -80928,51 +80996,21 @@ const useItemStore = ({
|
|
|
80928
80996
|
const pageItems = Array.isArray(page) ? page : page.items;
|
|
80929
80997
|
const pageStart = Array.isArray(page) ? 0 : page.start ?? 0;
|
|
80930
80998
|
const pageCount = Array.isArray(page) ? pageItems.length : page.count ?? pageStart + pageItems.length;
|
|
80999
|
+
const pageLanded = {
|
|
81000
|
+
pageItems,
|
|
81001
|
+
pageStart,
|
|
81002
|
+
pageCount
|
|
81003
|
+
};
|
|
81004
|
+
if (!mountedRef.current) {
|
|
81005
|
+
// No render is coming to take it in, and the source still keeps
|
|
81006
|
+
// what came back for the next list drawing this collection.
|
|
81007
|
+
takeInPage(pageLanded);
|
|
81008
|
+
return;
|
|
81009
|
+
}
|
|
80931
81010
|
// Before the items land: what is on screen has to stay where it is,
|
|
80932
81011
|
// and the DOM still shows the state to hold onto.
|
|
80933
81012
|
listItems.captureAnchor();
|
|
80934
|
-
|
|
80935
|
-
// it at another rank (it would be drawn twice), or when its rank is
|
|
80936
|
-
// past the end of the collection.
|
|
80937
|
-
const staleRanksNow = staleRanksRef.current;
|
|
80938
|
-
const pageEnd = pageStart + pageItems.length;
|
|
80939
|
-
let dropped = false;
|
|
80940
|
-
if (staleRanksNow.size > 0) {
|
|
80941
|
-
const pageIds = new Set();
|
|
80942
|
-
for (const pageItem of pageItems) {
|
|
80943
|
-
if (pageItem && pageItem.id !== undefined) {
|
|
80944
|
-
pageIds.add(pageItem.id);
|
|
80945
|
-
}
|
|
80946
|
-
}
|
|
80947
|
-
for (const rank of staleRanksNow) {
|
|
80948
|
-
if (rank >= pageStart && rank < pageEnd) {
|
|
80949
|
-
continue;
|
|
80950
|
-
}
|
|
80951
|
-
const staleItem = pages.byIndex.get(rank);
|
|
80952
|
-
if (rank >= pageCount || staleItem && pageIds.has(staleItem.id)) {
|
|
80953
|
-
staleRanksNow.delete(rank);
|
|
80954
|
-
pages.byIndex.delete(rank);
|
|
80955
|
-
dropped = true;
|
|
80956
|
-
}
|
|
80957
|
-
}
|
|
80958
|
-
}
|
|
80959
|
-
let i = 0;
|
|
80960
|
-
while (i < pageItems.length) {
|
|
80961
|
-
pages.byIndex.set(pageStart + i, pageItems[i]);
|
|
80962
|
-
staleRanksNow.delete(pageStart + i);
|
|
80963
|
-
i++;
|
|
80964
|
-
}
|
|
80965
|
-
pages.count = pageCount;
|
|
80966
|
-
// Which rank holds which id, kept by the source so a list drawing
|
|
80967
|
-
// this collection again finds it drawn (see readComposition above).
|
|
80968
|
-
if (itemsAction.writeComposition) {
|
|
80969
|
-
itemsAction.writeComposition({
|
|
80970
|
-
byIndex: pages.byIndex,
|
|
80971
|
-
count: pageCount,
|
|
80972
|
-
replace: dropped
|
|
80973
|
-
});
|
|
80974
|
-
}
|
|
80975
|
-
listItems.pagesSignal.value = listItems.pagesSignal.peek() + 1;
|
|
81013
|
+
pagesLandedRef.current.push(pageLanded);
|
|
80976
81014
|
setPageVersion(version => version + 1);
|
|
80977
81015
|
};
|
|
80978
81016
|
const failed = error => {
|