Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Make nav.updateChild replace instead of mutate in place
Damian Legawiec2a2a040ce863
diff --git a/packages/dashboard-core/src/lib/nav-registry.ts b/packages/dashboard-core/src/lib/nav-registry.tsindex bfdd0ce02b..9d0164b2e6 100644--- a/packages/dashboard-core/src/lib/nav-registry.ts+++ b/packages/dashboard-core/src/lib/nav-registry.ts@@ -159,9 +159,16 @@ export const nav: NavMutator = {},updateChild(parentKey, childKey, patch) {const parent = requireEntry(parentKey)- const child = parent.children?.find((c) => c.key === childKey)- if (!child) throw new Error(`Nav child "${childKey}" not found under "${parentKey}".`)- Object.assign(child, patch)+ const idx = parent.children?.findIndex((c) => c.key === childKey) ?? -1+ if (idx === -1 || !parent.children) {+ throw new Error(`Nav child "${childKey}" not found under "${parentKey}".`)+ }+ // Replace both the child and the array so the patched entry gets a fresh+ // reference in the next snapshot — in-place mutation would defeat any+ // reference-equality memoization on the item component.+ const next = [...parent.children]+ next[idx] = { ...next[idx], ...patch }+ parent.children = nextnotify()},}