Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

can Recoil stop update React Component update when atom value still same after update? #493

Closed
xuzhanhh opened this issue Jul 22, 2020 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@xuzhanhh
Copy link

xuzhanhh commented Jul 22, 2020

Hey guys! I want to stop rerender Component when atom/selector get the same value after updater. What should I do?

Here's the playground: https://codesandbox.io/s/stoic-resonance-vecxs?file=/src/App.js:758-811

actually, I try to normalize todoState in a atom(todoIdListState) and atomFamily(todoState) mapping in order to avoid updating all <TodoItem/>, but when I add a state filteredTodoIdListState whitch subscribe atomFamily(todoState), it will cause rerender <TodoList/> when I changing one todoState atom. How can I stop this rerender? Is there a way like react useState's internal compare check?
Here's the playground with normalize todo: https://codesandbox.io/s/condescending-sinoussi-d3ck0?file=/src/App.js:1853-1861

@xuzhanhh xuzhanhh changed the title can Recoil stop update React Component when atom value is same ? can Recoil stop update React Component update when atom value still same after update? Jul 22, 2020
@brianc
Copy link

brianc commented Jul 22, 2020

It looks like this commit might address that.

@drarmstr drarmstr added the duplicate This issue or pull request already exists label Jul 22, 2020
@drarmstr
Copy link
Contributor

Setting atoms is addressed with #386, limiting re-renders of selectors with the same value is duplicate of #314

@xuzhanhh
Copy link
Author

thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants