Doing multiple changes inside `transaction()` results multiple invocations of observer subscribed via `subscribe()`.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
Doing multiple changes inside `transaction()` results multiple invocations of observer subscribed via `subscribe()`.
How to reproduce:
``` javascript
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')
})
```
[Link to https://CodePen.io/j-sen/pen/OJjNKVK](https://codepen.io/j-sen/pen/OJjNKVK)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the example from the issue using the pinned sinuous@0.27.12 dist/observable.js build, focusing on the subscribe() and transaction() entry points. The behavior is corrected when the transaction logs only 3;30 instead of 3;12;30.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100