mobx-task icon indicating copy to clipboard operation
mobx-task copied to clipboard

Upgrade to MobX v6

Open jeffijoe opened this issue 3 years ago • 1 comments

Upgrades to the library to support MobX 6. We had to wrap the task in an action to prevent MobX from automatically converting it to an action.

BREAKING CHANGE: The decorator will break when a MobX decorator is used on the same method.

Closes #32

jeffijoe avatar Jul 27 '22 14:07 jeffijoe

Coverage Status

Coverage remained the same at 100.0% when pulling f2f25786850e2b61cc1895e9d25ebfa2aab6c337 on mobx-6 into 24704082d91723e51bc8b426d3181e0ac5e02217 on master.

coveralls avatar Jul 27 '22 14:07 coveralls

:tada: This PR is included in version 3.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jeffijoe avatar Aug 22 '22 15:08 jeffijoe

@jeffijoe Awesome news! Does it work with mobx's makeObservable method?

kkollman avatar Aug 30 '22 16:08 kkollman

I am not sure since I haven't used it, but I don't see why not, try it out and let me know!

jeffijoe avatar Aug 30 '22 17:08 jeffijoe

Yeah, I checked it and unfortunately, it doesn't - mobx throws an Invalid annotation error. If I find any solution, I'll post it here

kkollman avatar Aug 31 '22 07:08 kkollman

My recommendation is to use property initializers like this:

class MyClass {
  myTask = task(async () => ...)
}

jeffijoe avatar Aug 31 '22 10:08 jeffijoe

Thank you, that is what I'll do!

kkollman avatar Aug 31 '22 14:08 kkollman