dai-shi / use-atom

Yet another implementation for Jotai atoms without side effects
MIT License
109 stars 0 forks source link

Avoid rerenders if atom value doesn't change #28

Open SukkaW opened 2 years ago

SukkaW commented 2 years ago

The issue is similar to the one in the jotai: https://github.com/pmndrs/jotai/issues/1158#issuecomment-1126839533

image

Is it possible to apply a fix similar to https://github.com/pmndrs/jotai/pull/1159, to prevent atoms with the same primitive value from unnecessary committing?

dai-shi commented 2 years ago

No, it's not possible because we always run update function in render phase. And, thus, side effects are not allowed in the update function.