cloudflare-next-intl 0.8.48 → 0.8.49
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const defaultStaleDeployPatterns: readonly string[];
|
|
2
2
|
export declare function setStaleDeployPatterns(patterns: readonly string[]): void;
|
|
3
3
|
export declare function getStaleDeployPatterns(): readonly string[];
|
|
4
|
-
export default function isStaleDeployError(error:
|
|
4
|
+
export default function isStaleDeployError(error: unknown, patterns?: readonly string[]): boolean;
|
|
@@ -18,8 +18,18 @@ export function getStaleDeployPatterns() {
|
|
|
18
18
|
return activePatterns;
|
|
19
19
|
}
|
|
20
20
|
export default function isStaleDeployError(error, patterns) {
|
|
21
|
+
// A stale build can leave the caught value itself missing — e.g. an
|
|
22
|
+
// aborted RSC stream reaching a client component as `undefined` rather
|
|
23
|
+
// than a real Error (seen as "Global Error undefined ... The above error
|
|
24
|
+
// occurred in a React component" in the console, with no message to
|
|
25
|
+
// pattern-match on). Treat exactly `undefined` as stale-deploy; a normal
|
|
26
|
+
// thrown error is never `undefined`.
|
|
27
|
+
if (error === undefined)
|
|
28
|
+
return true;
|
|
21
29
|
if (!error)
|
|
22
30
|
return false;
|
|
31
|
+
if (!(error instanceof Error))
|
|
32
|
+
return false;
|
|
23
33
|
if (error.name === 'ChunkLoadError')
|
|
24
34
|
return true;
|
|
25
35
|
const message = (error.message || '').toLowerCase();
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* marker already covers.
|
|
8
8
|
*/
|
|
9
9
|
export declare function isRecentBuild(setAt: number | null, now: number, windowMs?: number): boolean;
|
|
10
|
-
export declare function shouldRecoverFromStaleDeploy(error:
|
|
10
|
+
export declare function shouldRecoverFromStaleDeploy(error: unknown, buildId: string, marker: string | null, recentBuild?: boolean): boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Detects a stale-deploy error and, once per build id, silently clears client
|
|
13
13
|
* caches and reloads after `delayMs`. Returns whether a reload is pending so
|
|
@@ -16,4 +16,4 @@ export declare function shouldRecoverFromStaleDeploy(error: Error, buildId: stri
|
|
|
16
16
|
* a server action) and its rejection is ignored — cache clearing is
|
|
17
17
|
* best-effort.
|
|
18
18
|
*/
|
|
19
|
-
export default function useStaleDeployRecovery(error:
|
|
19
|
+
export default function useStaleDeployRecovery(error: unknown, onRecover?: () => Promise<unknown>, delayMs?: number): boolean;
|