Skip to content

Middleware Excecution Flow #15

@karandeepsingh7070

Description

@karandeepsingh7070

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions