WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

Testing: Idea for E2E runtime store unhandled action mutations #9061

Open aduth opened 6 years ago

aduth commented 6 years ago

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.

nerrad commented 5 years ago

This still something to do/needed eventually @aduth ?

aduth commented 5 years ago

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).