@dudousxd/nestjs-durable-dashboard 0.46.0 → 0.46.1
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.
|
@@ -10,7 +10,13 @@ import { ConsoleSessionError, type OpenConsoleOptions } from '../client/console-
|
|
|
10
10
|
export interface UseOpenConsoleResult {
|
|
11
11
|
/** Start the mint-then-navigate. Never rejects — read `error` instead. */
|
|
12
12
|
open: () => void;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* True from the click until the navigation starts, or until it fails.
|
|
15
|
+
*
|
|
16
|
+
* With the DEFAULT navigation it stays true afterwards, because the page is being replaced and
|
|
17
|
+
* flipping the button back to idle would flicker "ready to click again" on a document that is
|
|
18
|
+
* leaving. With a caller-supplied `navigate` it is cleared on success — see {@link open}.
|
|
19
|
+
*/
|
|
14
20
|
isPending: boolean;
|
|
15
21
|
/** The last refusal, or `null`. Cleared when `open()` is called again. */
|
|
16
22
|
error: ConsoleSessionError | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-open-console.d.ts","sourceRoot":"","sources":["../../src/react/use-open-console.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,KAAK,kBAAkB,EAExB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"use-open-console.d.ts","sourceRoot":"","sources":["../../src/react/use-open-console.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,KAAK,kBAAkB,EAExB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClC,uEAAuE;IACvE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,kBAAuB,GAAG,oBAAoB,CA8D5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,GAAE,kBAAuB,GAAG;IACnF,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,CAKA"}
|
|
@@ -10,14 +10,22 @@ export function useOpenDurableConsole(options = {}) {
|
|
|
10
10
|
const open = useCallback(() => {
|
|
11
11
|
setIsPending(true);
|
|
12
12
|
setError(null);
|
|
13
|
+
// Whether success ends this page's life is decided by WHO navigates.
|
|
14
|
+
//
|
|
15
|
+
// The default navigation replaces the document, so `isPending` is deliberately left set: the
|
|
16
|
+
// component is about to be torn down, and flipping the button back to idle first shows a
|
|
17
|
+
// flicker of "ready to click again" on a page that is leaving.
|
|
18
|
+
//
|
|
19
|
+
// A caller-supplied `navigate` carries no such promise — the option's own documentation offers
|
|
20
|
+
// "open in a new tab" as a use for it, and that keeps this page alive and on screen. Assuming
|
|
21
|
+
// teardown there left the button `disabled` forever, with only a reload to clear it: the launcher
|
|
22
|
+
// worked exactly once per page. So when the caller navigates, the flag reports the truth (the
|
|
23
|
+
// mint finished) rather than a guess about the page.
|
|
24
|
+
const callerNavigates = optionsRef.current.navigate !== undefined;
|
|
13
25
|
void openDurableConsole(optionsRef.current)
|
|
14
26
|
.then(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// a visible flicker of "ready to click again" on a page that is leaving.
|
|
18
|
-
//
|
|
19
|
-
// The page leaving is not the same as the page dying — see the `pageshow` effect below,
|
|
20
|
-
// which is what un-sticks this flag when the user comes back.
|
|
27
|
+
if (callerNavigates)
|
|
28
|
+
setIsPending(false);
|
|
21
29
|
})
|
|
22
30
|
.catch((cause) => {
|
|
23
31
|
setError(cause instanceof ConsoleSessionError
|
|
@@ -26,8 +34,9 @@ export function useOpenDurableConsole(options = {}) {
|
|
|
26
34
|
setIsPending(false);
|
|
27
35
|
});
|
|
28
36
|
}, []);
|
|
29
|
-
// The counterpart to leaving `isPending` set on success
|
|
30
|
-
// discarded once the navigation completes — but with the browser's
|
|
37
|
+
// The counterpart to leaving `isPending` set on success under the DEFAULT navigation. That choice
|
|
38
|
+
// assumes the launcher page is discarded once the navigation completes — but with the browser's
|
|
39
|
+
// back/forward cache it is not:
|
|
31
40
|
// pressing Back restores this page from memory with React state intact, so the user lands back on
|
|
32
41
|
// a spinner that never stops, on a button `disabled` by that very flag. This is the one signal
|
|
33
42
|
// that says "you are looking at a restored page": browsers fire `pageshow` with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-open-console.js","sourceRoot":"","sources":["../../src/react/use-open-console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-open-console.js","sourceRoot":"","sources":["../../src/react/use-open-console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AA2BtC,MAAM,UAAU,qBAAqB,CAAC,UAA8B,EAAE;IACpE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC,CAAC;IAErE,kGAAkG;IAClG,wFAAwF;IACxF,MAAM,UAAU,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K,CAAC,CAAC;QACpE,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAClE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iCAAiC,CAAC,UAA8B,EAAE;IAIhF,OAAO;QACL,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAU;QAC9E,UAAU,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-durable-dashboard",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"description": "Embedded control plane (runs, step timeline, retry/cancel) for nestjs-durable — bundled React SPA served by NestJS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|