@dudousxd/nestjs-durable-dashboard 0.39.1 → 0.40.0
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/react/use-open-console.d.ts.map +1 -1
- package/dist/react/use-open-console.js +25 -1
- package/dist/react/use-open-console.js.map +1 -1
- package/dist/spa/assets/index-BEIPxEnJ.js +80 -0
- package/dist/spa/assets/index-Ck6guUlr.css +1 -0
- package/dist/spa/assets/index-cv874oA3.js +1 -0
- package/dist/spa/assets/preview-ae5pIZMH.js +1 -0
- package/dist/spa/index.html +3 -4
- package/dist/spa/preview.html +3 -3
- package/package.json +7 -1
- package/dist/spa/assets/index-AKaTbEKr.js +0 -40
- package/dist/spa/assets/index-B2Kz5wtG.css +0 -1
- package/dist/spa/assets/index-EP2O5ZfT.css +0 -1
- package/dist/spa/assets/index-kCrHKxZp.js +0 -27
- package/dist/spa/assets/preview-G8TH2d5R.js +0 -1
|
@@ -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,0EAA0E;IAC1E,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,
|
|
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,0EAA0E;IAC1E,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,CAsD5F;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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useRef, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { ConsoleSessionError, openDurableConsole, } from '../client/console-session.js';
|
|
3
3
|
export function useOpenDurableConsole(options = {}) {
|
|
4
4
|
const [isPending, setIsPending] = useState(false);
|
|
@@ -15,6 +15,9 @@ export function useOpenDurableConsole(options = {}) {
|
|
|
15
15
|
// Deliberately NOT clearing `isPending` on success: the navigation is already underway and
|
|
16
16
|
// this component is about to be torn down. Flipping the button back to idle first produces
|
|
17
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.
|
|
18
21
|
})
|
|
19
22
|
.catch((cause) => {
|
|
20
23
|
setError(cause instanceof ConsoleSessionError
|
|
@@ -23,6 +26,27 @@ export function useOpenDurableConsole(options = {}) {
|
|
|
23
26
|
setIsPending(false);
|
|
24
27
|
});
|
|
25
28
|
}, []);
|
|
29
|
+
// The counterpart to leaving `isPending` set on success. That choice assumes the launcher page is
|
|
30
|
+
// discarded once the navigation completes — but with the browser's back/forward cache it is not:
|
|
31
|
+
// pressing Back restores this page from memory with React state intact, so the user lands back on
|
|
32
|
+
// a spinner that never stops, on a button `disabled` by that very flag. This is the one signal
|
|
33
|
+
// that says "you are looking at a restored page": browsers fire `pageshow` with
|
|
34
|
+
// `persisted === true` only on a bfcache restore.
|
|
35
|
+
//
|
|
36
|
+
// Guard on `persisted` rather than on `pageshow` alone. A plain `pageshow` also fires on every
|
|
37
|
+
// ordinary load, and clearing the flag there would resurrect the flicker this hook exists to
|
|
38
|
+
// avoid — a mint that is genuinely still in flight (the user never left) must keep its spinner.
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
// No `window` under SSR — and nothing to restore there either.
|
|
41
|
+
if (typeof window === 'undefined')
|
|
42
|
+
return;
|
|
43
|
+
const onPageShow = (event) => {
|
|
44
|
+
if (event.persisted)
|
|
45
|
+
setIsPending(false);
|
|
46
|
+
};
|
|
47
|
+
window.addEventListener('pageshow', onPageShow);
|
|
48
|
+
return () => window.removeEventListener('pageshow', onPageShow);
|
|
49
|
+
}, []);
|
|
26
50
|
const reset = useCallback(() => setError(null), []);
|
|
27
51
|
return { open, isPending, error, reset };
|
|
28
52
|
}
|
|
@@ -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,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,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;AAqBtC,MAAM,UAAU,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