Skip to content

Refactor project state machine using pub-sub events? #5448

Open
@benjiwheeler

Description

@benjiwheeler

The project state machine currently serves to trigger events in various components in a roundabout way.

The components must check if a given project state has become the current project state, in their componentDidUpdate() functions.

An alternative approach would be to use an explicit pub-sub model; have components directly subscribe to actions which correspond to project state machine transitions.

One library we could use is https://github.com/mroderick/PubSubJS (this is the most-used js pubsub library, according to npm trends).

Sample usage: https://gist.github.com/pablen/63b57ee80877712ad00ca7849643b4a2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions