@farm.js/core 0.1.0-beta.23 → 0.1.0-beta.25

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.
@@ -142,6 +142,7 @@ declare class RouteManager {
142
142
  shouldHydrate: boolean;
143
143
  isClientComponent: boolean;
144
144
  islandStrategy: FarmIslandStrategy | null;
145
+ suppressedAsyncHydration?: true;
145
146
  search?: ProgrammaticRouteSearchClientOptions;
146
147
  segments: Array<{
147
148
  segment: string;
@@ -142,6 +142,7 @@ declare class RouteManager {
142
142
  shouldHydrate: boolean;
143
143
  isClientComponent: boolean;
144
144
  islandStrategy: FarmIslandStrategy | null;
145
+ suppressedAsyncHydration?: true;
145
146
  search?: ProgrammaticRouteSearchClientOptions;
146
147
  segments: Array<{
147
148
  segment: string;
@@ -34,7 +34,7 @@ import {
34
34
  mergeFarmFontCss,
35
35
  mergeFarmViteConfig,
36
36
  resolveRouteRenderingConfigFromFile
37
- } from "./chunk-TX54PXAJ.mjs";
37
+ } from "./chunk-PHTZCPPQ.mjs";
38
38
  import {
39
39
  farmEnvironmentFunctionsPlugin
40
40
  } from "./chunk-V6WE6JSZ.mjs";
@@ -1257,6 +1257,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1257
1257
  const applicableClientLayouts = clientLayouts.filter(
1258
1258
  (layout) => layout.shouldHydrate && layoutAppliesToRoute(layout.pattern, route.pattern)
1259
1259
  );
1260
+ if (metadata.suppressedAsyncHydration) {
1261
+ logger.warn(
1262
+ `\u26A0\uFE0F ${route.pattern} is an async server component that imports client components; React cannot hydrate async components, so the route stays server-rendered and its client imports are not interactive.`
1263
+ );
1264
+ }
1260
1265
  if (metadata.shouldHydrate || applicableClientLayouts.length > 0) {
1261
1266
  const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
1262
1267
  const hydrationStrategies = [
@@ -2134,6 +2139,13 @@ async function createMatchedHydrationElement(matched, pathname, searchParams) {
2134
2139
  if (matched.route.pageShouldHydrate) {
2135
2140
  const Component = await loadRouteComponent(matched.route);
2136
2141
  if (!Component) return null;
2142
+ if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
2143
+ console.warn(
2144
+ "[Farm.js] Skipping hydration for " + pathname +
2145
+ ": async server components cannot run in the browser. Server-rendered HTML is preserved."
2146
+ );
2147
+ return null;
2148
+ }
2137
2149
  const props = { params: params, searchParams: Promise.resolve(searchParams) };
2138
2150
  pageElement = React.createElement(Component, props);
2139
2151
  } else if (hydrateLayouts) {
@@ -7039,4 +7051,4 @@ __name(buildNitro, "buildNitro");
7039
7051
  export {
7040
7052
  build
7041
7053
  };
7042
- //# sourceMappingURL=chunk-FJGTYLCO.mjs.map
7054
+ //# sourceMappingURL=chunk-2TUR37EP.mjs.map