-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[mobx6] @action.bound decorator not binding #2522
Comments
Please check existing issues or the mobx migration guide.
…On Sat, 17 Oct 2020, 22:08 Anri Asaturov, ***@***.***> wrote:
*Intended outcome:*
Trying to use @action.bound in a class with makeObservable(this) and
reference @observable property of the same class. The solution from #2468
<#2468> does not work.
class C {
@observable x!: number; // if assigned here - works
@action.bound // but not really
incX() {
this.x++;
}
constructor() {
// this.x = 0 // if assigned here - works
makeObservable(this);
this.x = 0; // if assigned here - breaks
}}
*Actual outcome:*
action does not getting actually bound.
Surprisingly, initializing property makes action bound properly.
*How to reproduce the issue:*
https://codesandbox.io/s/distracted-glade-y30yg?file=/src/index.ts
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2522>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBE5OF7RGBYVTHBP3LDSLIBVNANCNFSM4SUTNKDQ>
.
|
@mweststrate I did, if you're referring to tsconfig.json: |
I raised this issue because you asked to do it here #2467 and it's still reproducing in 6.0.1 |
Ah yes, sorry, was reading to quickly, apologies. This is probably an earlier reported babel bug, it has been fixed already, but it might not yet be available in Parcel / Code Sandbox already. See #2486, babel/babel#12146. Best check first if Babel 7.12 or higher is used behind the scenes. |
@mweststrate I was just trying to figure out why can't I reproduce it locally, so you're probably right, thank you. |
Added it to the docs, since more people will probably stumble on it as well. |
Intended outcome:
Trying to use
@action.bound
in a class withmakeObservable(this)
and reference@observable property
of the same class. The solution from #2468 does not work.Actual outcome:
Action is not getting actually bound.
Surprisingly, initializing property makes action bound properly.
How to reproduce the issue:
https://codesandbox.io/s/distracted-glade-y30yg?file=/src/index.ts
The text was updated successfully, but these errors were encountered: