Open aduth opened 6 years ago
This still something to do/needed eventually @aduth ?
I think the general problem is still valuable to solve. It is extremely easy to introduce a faulty reducer implementation which ruins performance benefits we'd gain by otherwise maintaining reference of an unchanging state.
The proposed implementation might need a rethink, particularly if we're slated to deprecate plugins (#11449).
Related: https://github.com/WordPress/gutenberg/pull/1084
If a store's reducer returns a new object value for an unhandled action, it can result in significant performance degradation. It is not certain that this currently exists, but we should include test case(s) to assure that it is not introduced. This is difficult to achieve in Gutenberg because there are many stores, and while a test case could be added for each package's reducer, this is not necessarily obvious to developers nor the most efficient approach.
Instead, we might consider introducing this to end-to-end tests, leveraging the new data plugin API (#8341). The plugin would simply be responsible for hooking in to the registration of a store, running the simple test case (d0158e0553bfb40deef5d51e2919dae0475ee3f8) and throwing an error to trigger the E2E failure. This would capture all unnecessary action handling for the default set of editor stores.