fix(web): re-sync store chainId to brand.defaultChainId after loadBrandConfig (white-label default chain)

This commit is contained in:
zeekay
2026-06-23 16:27:05 -07:00
parent 3b1ad33433
commit 82e0d5512e
+10 -1
View File
@@ -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(