You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you think others will benefit from this change as well and it should in core package (see also mobx-utils)?
Are you willing to (attempt) a PR yourself?
This is my stupid mistake, but figure it out take me a lot time.
export const BadStore = new class {
@observable Text = "" // Text = observable("")
@action get String() { // stupid mistake here, should not have a `get`
//
}
@action Update(s) {
this.Text = s
}
}
autorun(()=>{
console.log(BadStore.Text)
})
BadStore.Update("hello")
My bad that did not notice the grammar mistake, but I got these error message in the console:
mobx.js:1345 [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Autorun@3] TypeError: Object.defineProperty called on non-object
at Function.defineProperty (<anonymous>)
at classPropertyDecorator (/js/app.bundle.js:23322:24)
at /js/app.bundle.js:23355:64
at /js/app.bundle.js:20790:43
at action (/js/app.bundle.js:20771:39)
at /js/app.bundle.js:20750:25
at /js/app.bundle.js:23332:17
at /js/app.bundle.js:23371:122
at Array.forEach (native)
at runLazyInitializers (/js/app.bundle.js:23371:82)
The error message did not point me to the real error place. So i did some search. And I changed @observable Text = "" to Text = observable(""). It solved, no error message now.
But this confused me more. It should not be fix like this. Finally I find the mistake.
So I think a more accurate error message here would be very helpful.
The text was updated successfully, but these errors were encountered:
I have a*:
This is my stupid mistake, but figure it out take me a lot time.
My bad that did not notice the grammar mistake, but I got these error message in the console:
The error message did not point me to the real error place. So i did some search. And I changed
@observable Text = ""
toText = observable("")
. It solved, no error message now.But this confused me more. It should not be fix like this. Finally I find the mistake.
So I think a more accurate error message here would be very helpful.
The text was updated successfully, but these errors were encountered: