@jsenv/navi 0.30.36 → 0.30.37
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 +31 -9
- package/dist/dev/jsenv_navi.js.map +3 -3
- package/dist/jsenv_navi.js +31 -9
- package/dist/jsenv_navi.js.map +3 -3
- package/docs/resource.md +4 -0
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -29381,8 +29381,9 @@ const debug$2 = (...args) => {
|
|
|
29381
29381
|
* policy as that verb, and is a write of its own for a dependent:
|
|
29382
29382
|
* `{ resource: ORDER, on: ["cancel"] }`. Its `rerunOn` says which reads of
|
|
29383
29383
|
* this resource it reruns (`{ GET_RANGE: true }`); a read it leaves out
|
|
29384
|
-
* follows `rerunOn` for its verb. A
|
|
29385
|
-
* already exposes (`withParams`, `store`…),
|
|
29384
|
+
* follows `rerunOn` for its verb. A verb's name in any case (`post`,
|
|
29385
|
+
* `get_many`…), or one the resource already exposes (`withParams`, `store`…),
|
|
29386
|
+
* throws. A `.scopedOne()` or
|
|
29386
29387
|
* `.scopedMany()` takes `writes` too, `.scopedMany()` with the plural verbs.
|
|
29387
29388
|
* @param {{ GET?: { ms?: number, max?: number }, GET_MANY?: { ms?: number, max?: number } }} [restCallbacks.keep] -
|
|
29388
29389
|
* how long an answer of a read is trusted, coming back to the same params
|
|
@@ -30938,12 +30939,15 @@ ${name}.many("${propertyName}") source location: ${declarationSite}`,
|
|
|
30938
30939
|
|
|
30939
30940
|
// expose one action per write named in `writes`
|
|
30940
30941
|
if (writes) {
|
|
30942
|
+
const membersExposed = Object.keys(stateFacade).filter(
|
|
30943
|
+
(key) => !VERB_KEYS.includes(key),
|
|
30944
|
+
);
|
|
30941
30945
|
for (const [writeName, write] of Object.entries(writes)) {
|
|
30942
30946
|
assertWriteCanBeNamed(
|
|
30943
30947
|
name,
|
|
30944
30948
|
writeName,
|
|
30945
30949
|
write,
|
|
30946
|
-
|
|
30950
|
+
membersExposed,
|
|
30947
30951
|
namedWriteVerbs,
|
|
30948
30952
|
);
|
|
30949
30953
|
const { verb: writeVerb, callback, rerunOn: writeRerunOn } = write;
|
|
@@ -31256,7 +31260,7 @@ const assertWriteCanBeNamed = (
|
|
|
31256
31260
|
name,
|
|
31257
31261
|
writeName,
|
|
31258
31262
|
write,
|
|
31259
|
-
|
|
31263
|
+
membersExposed,
|
|
31260
31264
|
namedWriteVerbs,
|
|
31261
31265
|
) => {
|
|
31262
31266
|
const where = `resource(${name}) writes.${writeName}`;
|
|
@@ -31265,9 +31269,9 @@ const assertWriteCanBeNamed = (
|
|
|
31265
31269
|
`${where}: "${writeName}" is a verb's name — a write named in "writes" takes a name of its own (cancel, archive…)`,
|
|
31266
31270
|
);
|
|
31267
31271
|
}
|
|
31268
|
-
if (
|
|
31272
|
+
if (membersExposed.includes(writeName)) {
|
|
31269
31273
|
throw new Error(
|
|
31270
|
-
`${where}: the resource already exposes "${writeName}" —
|
|
31274
|
+
`${where}: the resource already exposes "${writeName}" — a write takes a name none of its members has: ${membersExposed.join(", ")}`,
|
|
31271
31275
|
);
|
|
31272
31276
|
}
|
|
31273
31277
|
if (!write || typeof write !== "object") {
|
|
@@ -90744,8 +90748,19 @@ const useItemStore = ({
|
|
|
90744
90748
|
// was asked for, and the window keeps growing meanwhile: dropping what the
|
|
90745
90749
|
// page did not cover empties items on screen.
|
|
90746
90750
|
const staleRanksRef = useRef(null);
|
|
90751
|
+
// A run standing for no item has no rank to mark: its count is what is from
|
|
90752
|
+
// before, and no window frames anything that would ask for it again.
|
|
90753
|
+
const countStaleRef = useRef(false);
|
|
90754
|
+
const markHeldStale = () => {
|
|
90755
|
+
staleRanksRef.current = new Set(pages.byIndex.keys());
|
|
90756
|
+
countStaleRef.current = pages.count === 0;
|
|
90757
|
+
};
|
|
90747
90758
|
if (staleRanksRef.current === null) {
|
|
90748
|
-
|
|
90759
|
+
if (restored) {
|
|
90760
|
+
markHeldStale();
|
|
90761
|
+
} else {
|
|
90762
|
+
staleRanksRef.current = new Set();
|
|
90763
|
+
}
|
|
90749
90764
|
}
|
|
90750
90765
|
const takeInPage = ({
|
|
90751
90766
|
pageItems,
|
|
@@ -90784,6 +90799,7 @@ const useItemStore = ({
|
|
|
90784
90799
|
i++;
|
|
90785
90800
|
}
|
|
90786
90801
|
pages.count = pageCount;
|
|
90802
|
+
countStaleRef.current = false;
|
|
90787
90803
|
// Which rank holds which id, kept by the source so a list drawing
|
|
90788
90804
|
// this collection again finds it drawn (see readComposition above).
|
|
90789
90805
|
if (itemsAction.writeComposition) {
|
|
@@ -90819,7 +90835,7 @@ const useItemStore = ({
|
|
|
90819
90835
|
const invalidationRef = useRef(invalidation);
|
|
90820
90836
|
if (invalidationRef.current !== invalidation) {
|
|
90821
90837
|
invalidationRef.current = invalidation;
|
|
90822
|
-
|
|
90838
|
+
markHeldStale();
|
|
90823
90839
|
}
|
|
90824
90840
|
// The one request in flight, with the means to call it off: a page asked for
|
|
90825
90841
|
// a window the list has left is work the server and the browser are doing for
|
|
@@ -91017,7 +91033,8 @@ const useItemStore = ({
|
|
|
91017
91033
|
rank++;
|
|
91018
91034
|
}
|
|
91019
91035
|
}
|
|
91020
|
-
const
|
|
91036
|
+
const countStale = countStaleRef.current;
|
|
91037
|
+
const revalidating = staleFrom !== -1 || countStale;
|
|
91021
91038
|
// The list is held on an item nothing on screen leads to: the items it holds
|
|
91022
91039
|
// do not contain it, so no window it could draw will ever bring it. Only
|
|
91023
91040
|
// asking for it by name does.
|
|
@@ -91033,6 +91050,10 @@ const useItemStore = ({
|
|
|
91033
91050
|
const from = typeof wanted.index === "number" ? rankOfIndex(wanted.index) - Math.floor(budget / 2) : 0;
|
|
91034
91051
|
start = from < 0 ? 0 : from;
|
|
91035
91052
|
end = start + budget - 1;
|
|
91053
|
+
} else if (countStale) {
|
|
91054
|
+
// Nothing drawn to anchor on: the first page, like the very first ask.
|
|
91055
|
+
start = 0;
|
|
91056
|
+
end = budget - 1;
|
|
91036
91057
|
} else if (revalidating) {
|
|
91037
91058
|
// The items from before that the window draws, and the missing ones
|
|
91038
91059
|
// with them: one ask.
|
|
@@ -91234,6 +91255,7 @@ const useItemStore = ({
|
|
|
91234
91255
|
staleRanksRef.current.delete(rank);
|
|
91235
91256
|
rank++;
|
|
91236
91257
|
}
|
|
91258
|
+
countStaleRef.current = false;
|
|
91237
91259
|
setRefreshing(false);
|
|
91238
91260
|
return;
|
|
91239
91261
|
}
|