question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

5.4.1 Non observed properties are no longer included

See original GitHub issue

So 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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ItamarShDevcommented, Jun 10, 2019

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

0reactions
mweststratecommented, Oct 15, 2019

Published as 5.5.0

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found