Expensify / react-native-onyx

Persistent, offline-first state management solution for React Native. Easy to use with minimal config and boilerplate.
MIT License
160 stars 73 forks source link

Fix: collection subscriber updated when nothing changed #541

Closed chrispader closed 6 months ago

chrispader commented 6 months ago

@paultsimura @tgolen

Details

Fixes a problem where collection subscribers (or subscribers to sub-keys of a collection) would get updated even though the value didn't change. This PR checks if the previous and new values are equal and if so omit the update.

Related Issues

https://github.com/Expensify/react-native-onyx/issues/535

Automated Tests

Added a new test in onyxTests which tests for this exact case.

Manual Tests

Author Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop
blimpich commented 6 months ago

I feel like I'm missing a lot of context for this PR. What exact issue is this fixing?

chrispader commented 6 months ago

I feel like I'm missing a lot of context for this PR. What exact issue is this fixing?

@blimpich sorry, just updated the PR description

paultsimura commented 6 months ago

@tgolen could you please merge? 🙇

chrispader commented 6 months ago

resolved conflicts, nothing else changed

github-actions[bot] commented 6 months ago

🚀Published to npm in v2.0.36