Unexpected recalculations of derived stores
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- next.js, typescript
- Domain
- frontend
Research direction
Start by reproducing the navigation sequence in the playground-app: hydrate a $server store through EffectorNext, derive a value with map() or combine(), then navigate to a page without $server data. Trace when the derived store recalculates compared with sample() and useStoreMap(); done means confirming whether the extra recalculations are expected or preventing them when the upstream value has not changed.
Written by the indexing model from the issue text.
Description
In our nextjs app we get some data on a server and then hydrate it on client via EffectorNext component. Say we have $server store which serializes and sends data to the client. I noticed that if i have some derived store (say, $derived) based on this value via .map() or combine() utilitiy on each navigation i get multiple recalculations of this derived store despite the fact that the docs state that it should only recalculate when upstream store changes. Recalculations are called with the latest value of $server store.
Here are the steps to reproduce:
- provide some value via
$serverstore. Derived store calculates correctly - navigate to some other page with no
$servervalue provided. For some reason derived store recalculates.
If I use sample() everything is ok because this derived value gets serialized as well. useStoreMap works well too but with this approach i can't access this derived value in stores.
I reproduced this in playground-app in which there are not so many recalculations but in my production app i get 500+ calls on each not shallow page transition.
Am i doing something wrong and this is expected behavior? I expect combine to not be called at all.
- Dominant language
- TypeScript
- Stars
- 61
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
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.
More from effector/next
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·