Description
Currently, global middlewares are executed after local instance middleware by default in our state management flow.
We need to add a configuration option to allow users to control whether global middlewares should execute before or after local middlewares.
Why?
- Adds flexibility for advanced use cases.
- Helps users control middleware chaining for async workflows and side-effects.
- Aligns with dev expectations from other state libraries.
What needs to be done
-Add a config flag, e.g., globalMiddlewareFirst: boolean inside middleware API or useSharedState Hook
-
Update the middleware pipeline to respect this configuration:
-
If true, global runs before local.
-
If false, current behavior (local first, then global).
-
Add tests covering both configurations.
-
Update documentation with an example.
Skills Required:
TypeScript, Understanding of middleware pipelines and async flows and Basic test writing
Description
Currently, global middlewares are executed after local instance middleware by default in our state management flow.
We need to add a configuration option to allow users to control whether global middlewares should execute before or after local middlewares.
Why?
What needs to be done
-Add a config flag, e.g., globalMiddlewareFirst: boolean inside middleware API or useSharedState Hook
Update the middleware pipeline to respect this configuration:
If true, global runs before local.
If false, current behavior (local first, then global).
Add tests covering both configurations.
Update documentation with an example.
Skills Required:
TypeScript, Understanding of middleware pipelines and async flows and Basic test writing