@lolyjs/core 0.1.0-alpha.8 → 0.1.0-alpha.9

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/index.cjs CHANGED
@@ -5699,6 +5699,7 @@ function AppShell({
5699
5699
 
5700
5700
  // modules/runtime/client/bootstrap.tsx
5701
5701
  var import_jsx_runtime3 = require("react/jsx-runtime");
5702
+ var __loly_hydrated = false;
5702
5703
  async function loadInitialRoute(initialUrl, initialData, routes, notFoundRoute, errorRoute) {
5703
5704
  const isInitialNotFound = initialData?.notFound === true;
5704
5705
  const isInitialError = initialData?.error === true;
@@ -5725,7 +5726,7 @@ async function loadInitialRoute(initialUrl, initialData, routes, notFoundRoute,
5725
5726
  initialComponents = await notFoundRoute.load();
5726
5727
  } else {
5727
5728
  console.warn(
5728
- `[client] No route match found for ${initialUrl}. Available routes:`,
5729
+ `[client] No route match found for ${initialUrl}. Routes:`,
5729
5730
  routes.map((r) => r.pattern)
5730
5731
  );
5731
5732
  }
@@ -5739,21 +5740,24 @@ async function loadInitialRoute(initialUrl, initialData, routes, notFoundRoute,
5739
5740
  };
5740
5741
  }
5741
5742
  function bootstrapClient(routes, notFoundRoute, errorRoute = null) {
5742
- console.log("[loly:runtime] bootstrapClient called", {
5743
- routesCount: routes.length,
5744
- hasNotFound: !!notFoundRoute,
5745
- hasError: !!errorRoute
5746
- });
5743
+ if (__loly_hydrated) {
5744
+ console.warn("[loly:runtime] bootstrapClient SKIPPED (already hydrated)");
5745
+ return;
5746
+ }
5747
+ __loly_hydrated = true;
5748
+ console.log("[loly:runtime] bootstrapClient START");
5747
5749
  (async function bootstrap() {
5748
5750
  const container = document.getElementById(APP_CONTAINER_ID2);
5749
5751
  const initialData = getWindowData();
5750
5752
  console.log("[loly:runtime] bootstrap starting", {
5751
5753
  hasContainer: !!container,
5752
- containerId: APP_CONTAINER_ID2,
5753
- hasInitialData: !!initialData
5754
+ hasInitialData: !!initialData,
5755
+ containerId: APP_CONTAINER_ID2
5754
5756
  });
5755
5757
  if (!container) {
5756
- console.error(`[loly:runtime] Container #${APP_CONTAINER_ID2} not found for hydration`);
5758
+ console.error(
5759
+ `[loly:runtime] Container #${APP_CONTAINER_ID2} not found.`
5760
+ );
5757
5761
  return;
5758
5762
  }
5759
5763
  const initialUrl = window.location.pathname + window.location.search;
@@ -5787,13 +5791,9 @@ function bootstrapClient(routes, notFoundRoute, errorRoute = null) {
5787
5791
  }
5788
5792
  )
5789
5793
  );
5790
- console.log("[loly:runtime] React app hydrated successfully");
5794
+ console.log("[loly:runtime] Hydrated successfully");
5791
5795
  } catch (error) {
5792
- console.error(
5793
- "[loly:runtime] Error loading initial route components for",
5794
- initialUrl,
5795
- error
5796
- );
5796
+ console.error("[loly:runtime] Error during hydration:", error);
5797
5797
  window.location.reload();
5798
5798
  }
5799
5799
  })();