Skip to content

[dev] [discussion] think outside the MST box #4889

@southerneer

Description

@southerneer

Spurred by discussion here: #4854. I believe we're overusing MST and it makes our codebase overly complicated.

MST is perfectly adequate for our base data structures (bot, profile, chat, etc) since these structures can change often in the lifecycle of a user session, are very inter-dependent, and need to be persisted across app reloads. MST's features give us solutions to those problems more or less "for free".

There are other pieces of state (permissions for example) that don't change often, don't require persistence, and don't depend on other parts of the state tree. Using MST for this "simpler" state has side-effects and requires hacks that we should seek to eliminate.

It is this "simpler" state that I propose to move out of MST and into either vanilla mobx or React state (or whatever else makes sense). Some candidates for this change:

  • PermissionStore
  • HomeStore
  • NavStore
  • SearchStore

We already have some stores (like ReportStore) that are written with vanilla Mobx that are good examples of how we can convert the stores I mentioned above.

cc @aksonov @bengtan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions