artalar / act

Act is the most efficient reactive state library in both: speed, size, correctness.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subscriptions break when changing an unrelated act.

karapetyansa opened this issue · comments

If you add unrelated act to the test and then update it, the test will fail.

test('changing an unrelated act', () => {
    const result: number[] = []

    const side = act(0)
    side(1)
    const a = act(0)
    a.subscribe(s => {
        result.push(s)
    })
    a(1)
    act.notify()
    a(2)
    act.notify()
    a(3)
    act.notify()
    a(4)
    act.notify()

    assert.equal(result, [0, 1, 2, 3, 4])
})

If you remove side(1) then the test will be passed.

It looks like QUEUE_VERSION++ needs to be raised beyond the condition.