Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of non-MobX methods from MobX stores #3650

Open
Tracked by #3733
brojd opened this issue Jan 10, 2024 · 0 comments
Open
Tracked by #3733

Get rid of non-MobX methods from MobX stores #3650

brojd opened this issue Jan 10, 2024 · 0 comments

Comments

@brojd
Copy link
Contributor

brojd commented Jan 10, 2024

Currently in MobX stores we have methods that are none of the MobX entities (actions, computeds). Example:

getSearchResult(query = '') {
    if (!this.searchResult[query]) {
      return undefined;
    }
    return this.searchResult[query].map((msteamsChannelId: MSTeamsChannel['id']) => this.items[msteamsChannelId]);
  }

We should try to get rid of them so that in MobX stores we only have observables, computeds and actions. In the example above (and we have many such getSearchResult methods in different stores) we should check if this.searchResult is used anywhere else. If not, we should map it at the moment of saving in store instead of at the moment of retrieving from store. This way we will not need any mapping when getting search result and we will be able to consume observable directly from component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants