Skip to content

[Bug]: waitForEntityChange not recognising entities from id #485

@starknetdev

Description

@starknetdev

Dojo.js Version

1.7.0-preview.3

What happened?

Entities are being returned as undefined in the waitForEntityChange.

I can see it is triggering and the correct event is being recorded in the subscription. The platformMetricsEntityId also looks correct.

If this could be looked into as a priority that would be greatly appreciated.

What is the expected behavior?

Should be returning the entity in the callback so we can detect when a tx has completed.

console.log(entity) returns undefined

Steps to reproduce

export const useDojoStore: DojoStoreHook<SchemaType> =
  createDojoStore<SchemaType>();

const state = useDojoStore((state) => state);

const waitForTournamentCreation = async (totalTournaments: number) => {
  const platformMetricsEntityId = getEntityIdFromKeys([
    BigInt(TOURNAMENT_VERSION_KEY),
  ]);
  await state.waitForEntityChange(
    platformMetricsEntityId,
    (entity) => {
      console.log(entity);
      return (
        entity?.models?.[namespace]?.PlatformMetrics?.total_tournaments ==
        Number(totalTournaments)
      );
    },
    20000
  );
};

Trace

No response

Is there an existing issue for this?

  • I have searched the existing issues and verified no issue exits for this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions