cloudflare-next-intl 0.8.46 → 0.8.47

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.
@@ -45,7 +45,22 @@ export default function HelperScript() {
45
45
  if (prevBuild !== BUILD_ID) {
46
46
  localStorage.setItem('buildId', BUILD_ID);
47
47
  if(prevBuild){
48
- window.location.reload(true);
48
+ // Reloading while the document/RSC stream is
49
+ // still downloading is the same as pressing
50
+ // Stop: Firefox aborts the in-flight read and
51
+ // surfaces "The connection to the page was
52
+ // unexpectedly closed", which reaches React as
53
+ // a caught error and renders the app's error
54
+ // screen. Wait for the load to settle first.
55
+ if (document.readyState === 'complete') {
56
+ window.location.reload();
57
+ } else {
58
+ window.addEventListener(
59
+ 'load',
60
+ function () { window.location.reload(); },
61
+ { once: true },
62
+ );
63
+ }
49
64
  }
50
65
  }
51
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
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",