Skip to content

Don't trigger listener for not updated state listener changes #36

@christian-bromann

Description

@christian-bromann

If you listen to a certain state in tangle, e.g.:

interface State {
    propA: boolean
    propB: string
}

const ch = new Channel<State>('foobar', {
    propA: true,
    propB: "foobar"
});
const bus = await ch.registerPromise([ ... ])
bus.listen('propB', (val: string) => { ... })

The listener is also triggered even if the property wasn't changed, e.g.:

client.broadcast({ propA: false })

This causes unnecessary listener calls and could potentially decrease performance. Let's ensure to only trigger the listener if the property was changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions