deepObserve callback getting called multiple times within a single runInAction function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
I have a simple case that looks something like this:
const myArray = observable([]);
deepObserve(myArray, () => {
console.log("array update");
});
runInAction(() => {
myArray.length = 1;
myArray.length = 2;
});
The log in this case runs twice, once for each length modification, immediately after each.
Is this normal? I would expect that because those length updates are in a runInAction, the observer only gets updated once, after the action is fully executed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing deepObserve callback scheduling around the observable array and runInAction example, then reproduce the two length updates locally. Compare the callback count with the action boundary and document the expected behavior in a focused regression test; done means the observed behavior matches the intended batching semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100