← back to Homesonspec
fix Leaflet SSR: keep MapView out of the shared-ui barrel, subpath dynamic import
7c746ccb5ce23c8592bbcf9c34aebb6107beaf9b · 2026-07-22 11:37:37 -0700 · Steve Abrams
Files touched
M apps/web/src/app/search/SearchClient.tsxM packages/shared-ui/src/index.ts
Diff
commit 7c746ccb5ce23c8592bbcf9c34aebb6107beaf9b
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 22 11:37:37 2026 -0700
fix Leaflet SSR: keep MapView out of the shared-ui barrel, subpath dynamic import
---
apps/web/src/app/search/SearchClient.tsx | 4 ++--
packages/shared-ui/src/index.ts | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/apps/web/src/app/search/SearchClient.tsx b/apps/web/src/app/search/SearchClient.tsx
index 4266c2d..3486f96 100644
--- a/apps/web/src/app/search/SearchClient.tsx
+++ b/apps/web/src/app/search/SearchClient.tsx
@@ -5,8 +5,8 @@ import dynamic from "next/dynamic";
import Link from "next/link";
import { fmtPrice, VerificationBadge } from "@spechomes/shared-ui";
-// Leaflet needs window — client-only load.
-const MapView = dynamic(() => import("@spechomes/shared-ui").then((m) => m.MapView), { ssr: false });
+// Leaflet needs window — client-only load, direct file import (not the barrel).
+const MapView = dynamic(() => import("@spechomes/shared-ui/src/MapView").then((m) => m.MapView), { ssr: false });
interface Home {
id: string;
diff --git a/packages/shared-ui/src/index.ts b/packages/shared-ui/src/index.ts
index 9ab6296..c98d724 100644
--- a/packages/shared-ui/src/index.ts
+++ b/packages/shared-ui/src/index.ts
@@ -1,2 +1,4 @@
-export * from "./MapView";
+// MapView is deliberately NOT re-exported here: react-leaflet touches
+// `window` at module scope, so the barrel must stay SSR-safe. Import it
+// directly via `@spechomes/shared-ui/src/MapView` behind next/dynamic.
export * from "./badges";
← 6b477e6 consumer web app (search/detail/community/builder/contact) +
·
back to Homesonspec
·
generalize pipeline: hints column on StagedRecord, publisher 73a5db3 →