5.4.1 Non observed properties are no longer included
See original GitHub issueSo 5.4.1 fixed a previous error for https://github.com/mobxjs/mobx-utils/issues/191 but is causing another. Any properties that aren’t marked as observable simply don’t appear anymore.
If you cut and paste the below code into the demo sandbox, you’ll see what happens. the notObservedField
doesn’t exist… and in 5.2 it did.
https://codesandbox.io/s/wp88p
import React from "react";
import { render } from "react-dom";
import { observable, action, toJS } from "mobx";
import { observer } from "mobx-react";
import DevTools from "mobx-react-devtools";
import { createViewModel } from 'mobx-utils';
class MyClass {
@observable firstname;
@observable lastname;
notObservedField = 'im not included!';
someFunction(someParam) {
}
}
class AppState {
constructor() {
const myClass = new MyClass();
const observableMyClass = createViewModel(myClass);
console.log(toJS(observableMyClass));
// is now undefined in 5.4.1
console.log(observableMyClass.notObservedField);
}
@action.bound
reset() {
this.timer = 0;
}
}
const TimerView = observer(({ appState }) => (
<button onClick={appState.reset}>Seconds passed: {appState.timer}</button>
));
render(
<div>
<TimerView appState={new AppState()} />
<DevTools />
</div>,
document.getElementById("root")
);
Edit: I should also mention that this only happened in production builds for me? Dev builds worked fine. Was a bit of a panic after rollover.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Email non-delivery reports and SMTP errors in Exchange Online
Admins can learn about SMTP errors and non-delivery reports (also known as NDRs or bounce messages) that are generated in Exchange Online.
Read more >21.8.5 Miscellaneous Foreign Investment in Real Property Tax ...
Pub 527, Residential Rental Property (Including Rental of Vacation Homes) ... The foreign corporation (and not the individual) is the taxable party in...
Read more >ENTRY SUMMARY ACCEPTANCE AND REJECTION POLICY
5.4. 1 Non-ABI entry summaries may be rejected at any time up to 30 calendar days following the summary filing date. ABI/A, ABI/S...
Read more >ORR Unaccompanied Children Program Policy Guide: Section 5
The records of unaccompanied alien children are the property of ORR, and care providers may not release records without prior approval from ORR....
Read more >Failed to apply plugin [id 'com.android.application']
non of above solution not worked for me but this is worked for me just add in gradle.properties ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
notObservedField
was not logged also in 5.4.0 and 5.3.0 Am i missing the bugs?https://codesandbox.io/embed/minimal-mobx-react-project-jh2lz The latest version I can log the property is in 5.2.0
Published as 5.5.0