Doing multiple changes inside transaction()
results multiple invocations of observer subscribed via subscribe()
. #184
Open
Description
Doing multiple changes inside transaction()
results multiple invocations of observer subscribed via subscribe()
.
How to reproduce:
import 'https://unpkg.com/sinuous@0.27.12/dist/observable.js'
const {observable, subscribe, transaction, root}= self.observable
root(() => {
const a = observable(1)
const b = observable(2)
const log = []
subscribe(() => {
log.push(a() + b())
})
transaction(() => {
a(10)
b(20)
})
// Expected 3;30
// Got 3;12;30
console.assert(log.join(';') === '3;30')
})
Metadata
Assignees
Labels
No labels