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.

Mobx-utils/fromPromise.state is not Observable?

See original GitHub issue

I try to react when state change… but looks like state is not a observable…

const result = fromPromise(promise);
console.assert(isObservable(result.state), 'state is NOT an isObservable'); // AssertionError: state is NOT an isObservable

Full code… https://runkit.com/ridermansb/mobx-react-is-observable/0.0.5

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
urugatorcommented, May 25, 2017
isObservable(result.state)
// is evaluated to
isObservable("pending"); // value (string) can't be observable
// but:
isObservable(result, "state"); // true
0reactions
mweststratecommented, Jun 13, 2017

Good point, could be marked as @computed to fix that. On the other hand, it doesn’t change the semantics, as there is an observable backing behind it. So the computed wouldn’t do really anything. Do you need it to be explicitly observable @Ridermansb ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mobxjs/mobx-utils: Utility functions and common ... - GitHub
fromPromise takes a Promise, extends it with 2 observable properties that track the status of the promise and returns it. The returned object...
Read more >
fromPromise · MobX Guide - mamaya-spark
FULFILLED . Observable promises can be created immediately in a certain state using fromPromise.reject(reason) or fromPromise.resolve(value?)
Read more >
MobX - Observable value promised in a store constructor ...
FromPromise creates a new object wrapping the original promise. ... a normal promise in your example, not having a state property at all....
Read more >
mobx-utils - npm
fromPromise takes a Promise, extends it with 2 observable properties that track the status of the promise and returns it. The returned object ......
Read more >
mobx-utils: community driven utility belt for MobX - Medium
“fromPromise” takes a thennable and returns an object with the properties 'value', 'state' and 'reason'. These properties are all observable and ...
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