feat: add subdomain-based site context with SSR resolution
Resolve the active site from the request Host header on the server and expose it through a SiteContext provider so the app can vary rendering per subdomain. Serialize the resolved site into the document shell (data-site attribute + window.__SITE__) so client hydration matches the server render. Add host-based Vercel rewrites mapping each subdomain to its site root, and include unit tests for the site resolution logic.
This commit is contained in:
25
src/app.tsx
25
src/app.tsx
@@ -15,6 +15,7 @@ import ErrorBoundaryFallback from "./components/ErrorBoundaryFallback";
|
||||
import { BarsProvider, useBars } from "./context/bars";
|
||||
import { DarkModeProvider } from "./context/darkMode";
|
||||
import { AuthProvider } from "./context/auth";
|
||||
import { SiteProvider } from "./context/SiteContext";
|
||||
import { createWindowWidth, isMobile } from "~/lib/resize-utils";
|
||||
import { MOBILE_CONFIG } from "./config";
|
||||
import CustomScrollbar from "./components/CustomScrollbar";
|
||||
@@ -203,17 +204,19 @@ export default function App() {
|
||||
)}
|
||||
>
|
||||
<DarkModeProvider>
|
||||
<BarsProvider>
|
||||
<Router
|
||||
root={(props) => (
|
||||
<AuthProvider>
|
||||
<AppLayout>{props.children}</AppLayout>
|
||||
</AuthProvider>
|
||||
)}
|
||||
>
|
||||
<FileRoutes />
|
||||
</Router>
|
||||
</BarsProvider>
|
||||
<SiteProvider>
|
||||
<BarsProvider>
|
||||
<Router
|
||||
root={(props) => (
|
||||
<AuthProvider>
|
||||
<AppLayout>{props.children}</AppLayout>
|
||||
</AuthProvider>
|
||||
)}
|
||||
>
|
||||
<FileRoutes />
|
||||
</Router>
|
||||
</BarsProvider>
|
||||
</SiteProvider>
|
||||
</DarkModeProvider>
|
||||
</ErrorBoundary>
|
||||
</MetaProvider>
|
||||
|
||||
Reference in New Issue
Block a user