Reverting values to their previously committed value before Reactivity propagates still triggers recomputation
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- frontend
Research direction
Start by running the linked Solid playground and tracing the batch call, signal updates, and effect output described in the reproduction steps. Compare the final signal value with the computations that run, then establish the intended behavior and add or update coverage for reverting a value within one batch.
Written by the indexing model from the issue text.
Description
Describe the bug
Within a batch call, when setting a signal's value to a new value, and then back to the original value, effects are still run for the "changed" value.
This could be desired behavior, but I think an argument could be made for the behavior I'm expecting here.
The playground I've linked is a contrived example. I encountered this when trying to batch a couple store actions together, that involved this scenario of a value being changed, and then changed back to the original value at the start of the batch operation.
Your Example Website or App
https://playground.solidjs.com/anonymous/157e35f6-d812-4798-8222-082d559eec5f
Steps to Reproduce the Bug or Issue
- Go to the playground link
- Switch to the Console output in dev tools
- Click the 'Click' button
- Despite the final value of
num()being unchanged at the end ofbatch(...), the effect is run, and the "new" value ofnum()is logged to the console.memoNum()naturally does not have the same issue.
Expected behavior
I expect changes to signal values within batch to be "batched", with only the end result being considered in determining what changed and what effects to run. Note that when calling setNum(0) when num() is already 0, effects are not rerun.
Sorry I know this is probably an inaccurate expectation of what batch should do. The docs description doesn't make a lot of sense to me:
# batch
Holds executing downstream computations within the block until the end to prevent unnecessary recalculation. Solid Store's set method, Mutable Store's array methods, and Effects automatically wrap their code in a batch.
Screenshots or Videos
No response
Platform
N/A
Additional context
No response
- Dominant language
- TypeScript
- Stars
- 37k
- Forks
- 1.2k
- Avg merge
- 8h 43m
- Merged PRs (30d)
- 365
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from solidjs/solid
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handlesPossibly taken @MilindChatrabhuji claimed this 2 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
Similar issues
-
agentscan:mixed-signals pending triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vueuse/vueuse#5737 · 2 comments ·
Maintainers usually reply within 9 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Marker-Inc-Korea/AutoRAG#2288 ·
Maintainers usually reply within 1 day
-
Resources: New templates of Guangzhou Metro Line 13Possibly taken @rmt-svc claimed this today. Openresources
Difficulty 1/5 Under an hour Newbie friendliness 76/100
railmapgen/rmg-templates#2730 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
web
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day