Skip to content

Feat/137/v12 v13 support#145

Merged
SimonMcKinsey merged 15 commits intomasterfrom
feat/137/v12-v13-support
Nov 6, 2021
Merged

Feat/137/v12 v13 support#145
SimonMcKinsey merged 15 commits intomasterfrom
feat/137/v12-v13-support

Conversation

@SimonMcKinsey
Copy link

@SimonMcKinsey SimonMcKinsey commented Nov 5, 2021

@adamkleingit I've separated migration to small portions.
Angular v13 is now working with mobx newest version.
Fully tested.

However, I was forced to add to bank-v13 application the following:
makeAutoObservable(this);

Full snippet under account.store.ts:

  constructor() {
    if (localStorage.savedTransactions) {
      this.transactions = JSON.parse(localStorage.savedTransactions);
    }

    makeAutoObservable(this);

    autorun(() => {
      localStorage.savedTransactions = JSON.stringify(this.transactions);
    });
  }

Without it it wouldn't work.
I found the solution in this example: reactions.

Also, it seems like autorun is not encouraged with class component. Source: stackoverflow

I need a clarification on this one.
If everything seems legit, then I'll update the README as well with this new use case.

What am I missing here?

Thanks ahead.

Edit (06/11/2021): As I suspected, @EVASIVE suggested the same in his PR: #138

I'll update README

@github-actions
Copy link

github-actions bot commented Nov 5, 2021

Size Change: 0 B

Total Size: 0 B

compressed-size-action

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant