cloudflare-next-intl 0.9.56 → 0.9.57

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.
@@ -28,7 +28,7 @@ export default function HelperScript() {
28
28
  // answers with real JavaScript again, so it doubles as the
29
29
  // health probe below.
30
30
  var probeUrl = null;
31
- var maxProbes = 4;
31
+ var maxProbes = 3;
32
32
  function isStale(msg) {
33
33
  if (msg === undefined || msg === null) return true;
34
34
  msg = String(msg).toLowerCase();
@@ -37,15 +37,21 @@ export default function HelperScript() {
37
37
  }
38
38
  return false;
39
39
  }
40
+ // Cover the page, never replace it. Wiping document.body used
41
+ // to be safe because a reload followed immediately; now that a
42
+ // probe can run for a few seconds first, React keeps rendering
43
+ // against the tree and every removeChild/insertBefore throws,
44
+ // which crashes it into the very error UI this is hiding.
45
+ var overlayId = 'cfni-stale-deploy-overlay';
40
46
  function showOverlay() {
41
47
  try {
42
- if (document.documentElement) {
43
- document.documentElement.style.backgroundColor = '#ffffff';
44
- }
45
- if (document.body) {
46
- document.body.style.backgroundColor = '#ffffff';
47
- document.body.innerHTML = ${JSON.stringify(reloadHtml)};
48
- }
48
+ var root = document.documentElement;
49
+ if (!root || document.getElementById(overlayId)) return;
50
+ var el = document.createElement('div');
51
+ el.id = overlayId;
52
+ el.setAttribute('style', 'position:fixed;inset:0;z-index:2147483647;background:#ffffff;');
53
+ el.innerHTML = ${JSON.stringify(reloadHtml)};
54
+ (document.body || root).appendChild(el);
49
55
  } catch (e) {}
50
56
  }
51
57
  function doReload() {
@@ -77,7 +83,7 @@ export default function HelperScript() {
77
83
  console.warn('[StaleDeploy early-catch] Asset still unhealthy after', attempt + 1, 'probes - reloading anyway:', String(err));
78
84
  return doReload();
79
85
  }
80
- setTimeout(function() { probeThenReload(attempt + 1); }, 500 * Math.pow(2, attempt));
86
+ setTimeout(function() { probeThenReload(attempt + 1); }, 300 * Math.pow(2, attempt));
81
87
  });
82
88
  }
83
89
  function recover(msg, source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.9.56",
3
+ "version": "0.9.57",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",