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.

Not accessing the changed property doesn't call observe second time

See original GitHub issue

.observe() callback is not called if the changed property getter is not executed in the .observe() callback. Take a look at the example below. Execute it then try uncommenting the line and commenting the one above.

const observer = require('@risingstack/nx-observe');

const observable = observer.observable();

// This way doesn't call the callback twice
observer.observe(() => console.log(observable));

// This way works
// observer.observe(() => console.log(observable.value));

observable.value = 3;

setTimeout(() => observable.value = 4);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
solkimicrebcommented, Dec 7, 2016

Going to also add some basic benchmarks (nx-observe vs vanilla js for now). I guess it might be interesting for you too. (Right now I only have benchmarks for the whole nx-framework together)

1reaction
solkimicrebcommented, Dec 6, 2016

Just to clarify: instead of binding on observable properties once, nx-observe looks for yet unregistered parts of the function (hidden by conditionals or loops) on every run and binds on the newly revealed properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LiveData Observer isn't triggered for the second time
The currentData one gets any new values posted to this new source, and the fragment only has to observe that single LiveData once....
Read more >
LiveData overview - Android Developers
The setValue(T) method updates the value of the LiveData instance and notifies any active observers about the change.
Read more >
How to Observe Property Changes with LitElement and ...
You can use the changedProperties.has("<propName>") to find out if your property has been changed or not. If your property has been changed, ...
Read more >
Sharing your Netflix account - Netflix Help Center
A Netflix account is for people who live together in a single household. Sharing Netflix with someone who doesn't live with you. People...
Read more >
3 Known Issues and Workarounds - Oracle Help Center
Use either of the following workarounds to bypass the new password restrictions. Set the BACKWARD_COMPAT_PW_CHECK environment variable to true .
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