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

[undecorate] makeObservable not added to imports #2540

Closed
Arjan-Zuidema opened this issue Oct 20, 2020 · 5 comments · Fixed by #2584 or #2590
Closed

[undecorate] makeObservable not added to imports #2540

Arjan-Zuidema opened this issue Oct 20, 2020 · 5 comments · Fixed by #2584 or #2590
Labels
🎁 mobx-undecorate Issue or PR related to mobx-undecorate package

Comments

@Arjan-Zuidema
Copy link

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

@danielkcz danielkcz added the 🎁 mobx-undecorate Issue or PR related to mobx-undecorate package label Oct 20, 2020
@danielkcz
Copy link
Contributor

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.

@Arjan-Zuidema
Copy link
Author

Added the pull request #2543

@Arjan-Zuidema
Copy link
Author

It seems there was no new version released of undecorate, but a new version of MobX was released.

@danielkcz
Copy link
Contributor

Yeah, undecorate is still published manually, we will improve it eventually with #2530

@mweststrate
Copy link
Member

Released as mobx-undecorate@1.0.3

@github-actions github-actions bot mentioned this issue Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎁 mobx-undecorate Issue or PR related to mobx-undecorate package
Projects
None yet
3 participants