Skip to content

Issues with updateEach #159

@verybomb

Description

@verybomb

I found two issues while working with queries

updateEach callback doesn't include components with modifiers (Added, Destroyed, Changed) in the query, even though they are present during runtime:

world.query(Added(Foo)).updateEach(([foo]) => {
// Typescript says foo is undefined here, but it's Foo
})

world.query(Added(Foo), Bar).updateEach(([foo, bar]) => {
// Typescript says foo is Bar here and that bar is undefined
})

Calling updateEach on two identical queries where the order of components differ will cause the second query to get the previous queries sorting:

world.query(Player, Health).updateEach(([player, health], entity) => {

})

world.query(Health, Player).updateEach(([health, player], entity) => {
// player here is Health, and health is Player.
})

Codesandbox: https://codesandbox.io/p/sandbox/lwkk8q

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions