Starting code
import { decorate, observable, action } from "mobx";
class TestStore
{
testValue = 1;
testFunc = () =>
{
this.testValue++;
}
}
decorate(TestStore,
{
testValue: observable,
testFunc: action
});
export default TestStore();
Intended outcome:
import { observable, action, makeObservable } from "mobx";
class TestStore
{
testValue = 1;
testFunc = () =>
{
this.testValue++;
}
constructor() {
makeObservable(this);
}
}
export default TestStore();
Actual outcome:
import { observable, action } from "mobx";
class TestStore
{
testValue = 1;
testFunc = () =>
{
this.testValue++;
}
constructor() {
makeObservable(this);
}
}
export default TestStore();
How to reproduce the issue:
Just run npx mobx-undecorate
Versions
Undecorate 1.0.2
Would you mind submitting a PR with a test case with your code that's failing? It's always easier to fix things against tests.
Added the pull request https://github.com/mobxjs/mobx/pull/2543
It seems there was no new version released of undecorate, but a new version of MobX was released.
Yeah, undecorate is still published manually, we will improve it eventually with #2530
Released as [email protected]