Skip to content

Commit

Permalink
fix: recs component name matching
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianGreed committed Feb 28, 2025
1 parent 409c7e2 commit b94f26d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .changeset/stupid-falcons-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@dojoengine/state": patch
"template-vite-ts": patch
"@dojoengine/core": patch
"@dojoengine/create-burner": patch
"@dojoengine/create-dojo": patch
"@dojoengine/predeployed-connector": patch
"@dojoengine/react": patch
"@dojoengine/sdk": patch
"@dojoengine/torii-client": patch
"@dojoengine/torii-wasm": patch
"@dojoengine/utils": patch
"@dojoengine/utils-wasm": patch
---

fix: recs component matching
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export function defineContractComponents(world: World) {
{ player: RecsType.BigInt, directions: RecsType.StringArray },
{
metadata: {
name: "dojo_starter-DirectionsAvailable",
namespace: "dojo_starter",
name: "DirectionsAvailable",
types: ["contractaddress"],
customTypes: ["Direction"],
},
Expand All @@ -36,7 +37,8 @@ export function defineContractComponents(world: World) {
},
{
metadata: {
name: "dojo_starter-Moves",
namespace: "dojo_starter",
name: "Moves",
types: ["contractaddress", "u8", "enum", "bool"],
customTypes: ["Direction"],
},
Expand Down
4 changes: 3 additions & 1 deletion packages/state/src/recs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ export const setEntities = async <S extends Schema>(
continue;
}
const recsComponent = Object.values(components).find(
(component) => component.metadata?.name === componentName
(component) =>
`${component.metadata?.namespace}-${component.metadata?.name}` ===
componentName
);

if (recsComponent) {
Expand Down

0 comments on commit b94f26d

Please sign in to comment.