One of the features of the wp.data architecture is that registry listener functions (registered with registry.subscribe()) are only invoked on state _changes_ rather than on every dispatched action. Internally, the registry uses a simple === equality check to determine if the state has changed, and if so it calls all the subscribed listeners.
In our datastore reducers, we currently return a copy state (i.e. { ...state } in the default case for the switch, rather than returning the given state itself. This undermines the optimization we would otherwise get if we returned state un-copied instead.
This issue is has no observable side-effects, but it can be reproduced with tests. The condition which causes it is per-store however so we cannot for example add a single test to catch this across all stores.
_Do not alter or remove anything below. The following sections will be managed by moderators only._
state object if there are no changes to make from a matched action{ ...state } and replace with stateIB ✅
Code reviewed as well, just assigning to you for merge 👍🏻
All looks good. Checked codebase and haven't found occurrences of { ...state }. There are no visual changes on the frontend. All tests are passed and I can confirm that added tests fails if I add { ...state } to a random datastore reducer. QA :heavy_check_mark: