Repository: remix-run/react-router
File: packages/react-router/lib/dom/ssr/fog-of-war.ts (TypeScript)

Code before:
            "The next navigation/fetch to an undiscovered route will result in " +
            "a new document navigation to sync up with the latest manifest.",
        );
        return;
      }

      try {
        // This will hard reload the destination path on navigations, or the
        // current path on fetcher calls
        if (
          sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) ===
          manifest.version
        ) {
          // We've already tried fixing for this version, don' try again to
          // avoid loops - just let this navigation/fetch 404
          console.error(
            "Unable to discover routes due to manifest version mismatch.",
          );
          return;
        }

        sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
      } catch (error) {
        // Catches when storage is blocked
        // Skip version tracking and continue with reload
      }

      window.location.href = errorReloadPath;
      console.warn("Detected manifest version mismatch, reloading...");

      // Stall here and let the browser reload and avoid triggering a flash of
      // an ErrorBoundary if we threw (same thing we do in `loadRouteModule()`)
      await new Promise(() => {
        // check out of this hook cause the DJs never gonna re[s]olve this
      });
    } else if (res.status >= 400) {
      throw new Error(await res.text());
    }

    // Reset loop-detection on a successful response
    try {
      sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
    } catch {
      // Catches when storage is blocked
      // Skip version tracking and continue with reload
    }
    serverPatches = (await res.json()) as AssetsManifest["routes"];
  } catch (e) {
    if (signal?.aborted) return;
    throw e;
  }

Review comment (suggestion):
```suggestion
      } catch {
        // Session storage unavailable
      }
```

Code after:
            "The next navigation/fetch to an undiscovered route will result in " +
            "a new document navigation to sync up with the latest manifest.",
        );
        return;
      }

      try {
        // This will hard reload the destination path on navigations, or the
        // current path on fetcher calls
        if (
          sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) ===
          manifest.version
        ) {
          // We've already tried fixing for this version, don' try again to
          // avoid loops - just let this navigation/fetch 404
          console.error(
            "Unable to discover routes due to manifest version mismatch.",
          );
          return;
        }

        sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
      } catch {
        // Session storage unavailable
      }

      window.location.href = errorReloadPath;
      console.warn("Detected manifest version mismatch, reloading...");

      // Stall here and let the browser reload and avoid triggering a flash of
      // an ErrorBoundary if we threw (same thing we do in `loadRouteModule()`)
      await new Promise(() => {
        // check out of this hook cause the DJs never gonna re[s]olve this
      });
    } else if (res.status >= 400) {
      throw new Error(await res.text());
    }

    // Reset loop-detection on a successful response
    try {
      sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
    } catch {
      // Session storage unavailable
    }
    serverPatches = (await res.json()) as AssetsManifest["routes"];
  } catch (e) {
    if (signal?.aborted) return;
    throw e;
  }

  // Patch routes we don't know about yet into the manifest