@jsenv/navi 0.29.231 → 0.29.232
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 +38 -5
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +38 -5
- package/dist/jsenv_navi.js.map +2 -2
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -2849,6 +2849,9 @@ ${lines.join("\n")}`,
|
|
|
2849
2849
|
const willPrerunSet = new Set();
|
|
2850
2850
|
const willRunSet = new Set();
|
|
2851
2851
|
const willPromoteSet = new Set(); // prerun -> run requested
|
|
2852
|
+
// Asked for, already under way: the request adds no work, and answers with
|
|
2853
|
+
// the run that is already carrying it (see join_active_runs below).
|
|
2854
|
+
const willJoinSet = new Set();
|
|
2852
2855
|
const staysRunningSet = new Set();
|
|
2853
2856
|
const staysAbortedSet = new Set();
|
|
2854
2857
|
const staysFailedSet = new Set();
|
|
@@ -2900,8 +2903,11 @@ ${lines.join("\n")}`,
|
|
|
2900
2903
|
} else {
|
|
2901
2904
|
willRunSet.add(action);
|
|
2902
2905
|
}
|
|
2906
|
+
} else {
|
|
2907
|
+
// The request performs nothing, and still has to be answered: what
|
|
2908
|
+
// the caller asked for is the answer, not the running.
|
|
2909
|
+
willJoinSet.add(action);
|
|
2903
2910
|
}
|
|
2904
|
-
// Otherwise, ignore the request (action stays as-is)
|
|
2905
2911
|
} else if (isPrerun) {
|
|
2906
2912
|
willPrerunSet.add(action);
|
|
2907
2913
|
} else {
|
|
@@ -2928,6 +2934,7 @@ ${lines.join("\n")}`,
|
|
|
2928
2934
|
// Special case: action was prerun but not yet requested to run
|
|
2929
2935
|
// Just promote it to "run requested" without rerunning
|
|
2930
2936
|
willPromoteSet.add(actionToRun);
|
|
2937
|
+
willJoinSet.add(actionToRun);
|
|
2931
2938
|
continue;
|
|
2932
2939
|
}
|
|
2933
2940
|
handleActionRequest(actionToRun, "run");
|
|
@@ -3074,6 +3081,27 @@ ${lines.join("\n")}`);
|
|
|
3074
3081
|
actionToPromote.isPrerunSignal.value = false;
|
|
3075
3082
|
}
|
|
3076
3083
|
}
|
|
3084
|
+
|
|
3085
|
+
// A run asked for an action that is already running, or that already holds
|
|
3086
|
+
// the answer, performs nothing — and answers all the same, with the run
|
|
3087
|
+
// that IS carrying it. `await action.run()` then means the same thing to
|
|
3088
|
+
// every caller: the second one waits for the first one's request and reads
|
|
3089
|
+
// the same data, instead of being handed `undefined` before the network has
|
|
3090
|
+
// said anything. See the run() JSDoc.
|
|
3091
|
+
{
|
|
3092
|
+
for (const actionToJoin of willJoinSet) {
|
|
3093
|
+
const runningPromise = actionPromiseMap.get(actionToJoin);
|
|
3094
|
+
if (runningPromise) {
|
|
3095
|
+
hasAsync = true;
|
|
3096
|
+
resultArray.push({ type: "async", promise: runningPromise });
|
|
3097
|
+
} else {
|
|
3098
|
+
resultArray.push({
|
|
3099
|
+
type: "sync",
|
|
3100
|
+
result: actionToJoin.dataSignal.peek(),
|
|
3101
|
+
});
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3077
3105
|
if (DEBUG$2) {
|
|
3078
3106
|
console.groupEnd();
|
|
3079
3107
|
}
|
|
@@ -3228,10 +3256,15 @@ const createAction = (callback, rootOptions = {}) => {
|
|
|
3228
3256
|
return dispatchSingleAction(action, "prerun", options);
|
|
3229
3257
|
};
|
|
3230
3258
|
/**
|
|
3231
|
-
* Requests the action's data
|
|
3232
|
-
*
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3259
|
+
* Requests the action's data, and resolves with it.
|
|
3260
|
+
*
|
|
3261
|
+
* An action that is already RUNNING or COMPLETED already has it, so the
|
|
3262
|
+
* request starts nothing — it JOINS: the caller waits for the run that is
|
|
3263
|
+
* already carrying the question and reads the same answer. Which is what
|
|
3264
|
+
* makes `await action.run()` say one thing to every caller, whether it is
|
|
3265
|
+
* the one that asked first or the one that arrived while the request was
|
|
3266
|
+
* out. Use `rerun()` to force a fresh run ("refresh", "check now", any
|
|
3267
|
+
* explicit user intent to go back to the network).
|
|
3235
3268
|
*/
|
|
3236
3269
|
const run = (options) => {
|
|
3237
3270
|
action.debug(`${action}.run(${stringifyForDisplay(options)})`);
|