diff --git a/examples/react/react-app/src/App.tsx b/examples/react/react-app/src/App.tsx index c7daefd8..4e606dca 100644 --- a/examples/react/react-app/src/App.tsx +++ b/examples/react/react-app/src/App.tsx @@ -5,8 +5,6 @@ import "./App.css"; import { Direction } from "./utils"; import { getEntityIdFromKeys } from "@dojoengine/utils"; import { useDojo } from "./dojo/useDojo"; -import { getSyncEntities } from "@dojoengine/state"; -import { Subscription } from "@dojoengine/torii-client"; function App() { const { diff --git a/packages/state/src/recs/index.ts b/packages/state/src/recs/index.ts index 24d99a3b..fea54d34 100644 --- a/packages/state/src/recs/index.ts +++ b/packages/state/src/recs/index.ts @@ -57,27 +57,27 @@ export const getEntities = async ( /** * Fetches all entities and their components from the client. * @param client - The client instance for API communication. - * @param entities - An optional EntityKeysClause to filter entities. + * @param entityKeyClause - An optional EntityKeysClause to filter entities. * @param components - An array of component definitions. * @param limit - The maximum number of entities to fetch per request (default: 100). */ export const getEntitiesQuery = async ( client: Client, components: Component[], - entities: EntityKeysClause | undefined, + entityKeyClause: EntityKeysClause | undefined, limit: number = 1000 ) => { let cursor = 0; let continueFetching = true; while (continueFetching) { - const clause: Clause | null = entities + const clause: Clause | null = entityKeyClause ? { Keys: { keys: - "HashedKeys" in entities - ? entities.HashedKeys - : entities.Keys.keys, + "HashedKeys" in entityKeyClause + ? entityKeyClause.HashedKeys + : entityKeyClause.Keys.keys, pattern_matching: "FixedLen", models: [ ...components.map( @@ -108,7 +108,7 @@ export const getEntitiesQuery = async ( * Sets up a subscription to sync entity updates. * @param client - The client instance for API communication. * @param components - An array of component definitions. - * @param entities - An array of entities to watch for updates. + * @param entityKeyClause - An optional EntityKeysClause to filter entities. * @returns A promise that resolves with the subscription handler. */ export const syncEntities = async (