v2.7.0
New features
Until now, containers were exclusively bound to a single store, they would trigger actions based on the container component lifecycle and would require knowledge of the store and actions. We developed a new API that evolves the concept to be more flexible by inverting the relationship: containers act as boundaries for all stores that declare that they are containedBy
it. This enables some great properties:
- a container can be shared across multiple stores forming a single boundary
- containers are super lightweight and can be imported anywhere without bundling the store
- the stores themselves can declare their own lifecycle handlers
- stores that specify containedBy but end up in a tree without container, will trigger an async error, making possible to track unintended global store leaks. Read more in the new Container docs.
The old container API still exists and is supported, as it makes sense in other contexts like tests, but we recommend the new API for production use cases.
This release also:
- improved performance on pages with thousands of listeners for a single store
- enabled Devtools tracing by default