Skip to content

Commit

Permalink
fix(world): resolve system namespace label (#3232)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
alvrs and holic authored Sep 25, 2024
1 parent 98f937c commit 9d7fc85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/heavy-donkeys-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@latticexyz/world": patch
---

The `namespace` field in a multi-namespace config is now correctly resolved for systems.
This fixes a bug with root systems in a multi-namespace project.
6 changes: 5 additions & 1 deletion packages/world/ts/node/buildSystemsManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export async function buildSystemsManifest(opts: { rootDir: string; config: Worl
const artifact = getSystemArtifact(system);
const abi = artifact.abi.filter((item) => !excludedAbi.includes(formatAbiItem(item)));
const worldAbi = system.deploy.registerWorldFunctions
? abi.map((item) => (item.type === "function" ? { ...item, name: `${system.namespace}__${item.name}` } : item))
? abi.map((item) =>
item.type === "function"
? { ...item, name: system.namespace ? `${system.namespace}__${item.name}` : item.name }
: item,
)
: [];
return {
// labels
Expand Down
3 changes: 2 additions & 1 deletion packages/world/ts/node/resolveSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export async function resolveSystems({
const systems = systemContracts
.map((contract): ResolvedSystem => {
const systemConfig =
config.namespaces[contract.namespaceLabel].systems[contract.systemLabel] ??
config.namespaces[contract.namespaceLabel]?.systems[contract.systemLabel] ??
resolveNamespace({
label: contract.namespaceLabel,
namespace: config.namespaces[contract.namespaceLabel]?.namespace,
systems: {
[contract.systemLabel]: {},
},
Expand Down

0 comments on commit 9d7fc85

Please sign in to comment.