Unexpected recalculations of derived stores
- Dominant language
- TypeScript
- Stars
- 61
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
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:
1. provide some value via `$server` store. Derived store calculates correctly
2. navigate to some other page with no `$server` value 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.