subscribeWithSelector triggers on every store update, even if there is no change #2103
Answered
by
dai-shi
ivancuric
asked this question in
Bug report
-
Let's say I have the following store: const store = createStore()(subscribeWithSelector(() => {a: 1})) and the following two subscriptions: store.subscribe(
(x) => x.a,
(a) => console.log(a),
);
store.subscribe((x) => console.log(x)); Updating the store with the same value using Is this an expected behaviour? |
Beta Was this translation helpful? Give feedback.
Answered by
dai-shi
Oct 5, 2023
Replies: 1 comment 4 replies
-
If you use |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It depends on your goal.
I think triggering a callback (that does nothing based on a condition) can be more lightweight than a shallow comparison.
(but, in general, we need to "measure" to discuss performance. all I'm saying is hypothetical or intuitive.)