From 82e0d5512e76c7392207bcc5e7f7a31097002c18 Mon Sep 17 00:00:00 2001 From: zeekay Date: Tue, 23 Jun 2026 16:27:05 -0700 Subject: [PATCH] fix(web): re-sync store chainId to brand.defaultChainId after loadBrandConfig (white-label default chain) --- apps/web/src/main.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index 315f249c..58cfd951 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -10,10 +10,19 @@ */ import { StrictMode } from "react" import { createRoot } from "react-dom/client" -import { loadBrandConfig } from "@luxfi/wallet-brand" +import { brand, loadBrandConfig } from "@luxfi/wallet-brand" import App from "./App" +import { useAppStore } from "./store" loadBrandConfig().finally(() => { + // The store's `chainId` is seeded from `brand.defaultChainId` at module + // eval — which runs BEFORE this async load mutates the brand singleton. + // Re-sync it now (before first paint) so the active chain follows the + // white-label brand (e.g. Hanzo → 36963, Zoo → 200200), not the bundled + // Lux default. `brand` stays the single source of truth. + const { chainId, setChainId } = useAppStore.getState() + if (chainId !== brand.defaultChainId) setChainId(brand.defaultChainId) + const el = document.getElementById("root") if (!el) throw new Error("missing #root") createRoot(el).render(