mirror of
https://github.com/luxfi/wallet.git
synced 2026-07-27 03:37:41 +00:00
fix(web): re-sync store chainId to brand.defaultChainId after loadBrandConfig (white-label default chain)
This commit is contained in:
+10
-1
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user