Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Console in browser show two different values for a field at the same time depending on the foldedness

I print out my object to the console. It clearly shows that the value of field locked is true. However, unfolding it to view closer details, shows the value of false. At the same time!

I perfectly understand it’s not black magic, so the value only can be one of those at the same time. It means that the rendition of the value to the console somehow gets affected. Restarting the browser, the computer and switching between Edge and Chrome give no change. It also happens at another computer.

I suspect that it’s something with the applications wire-up that confuses the browser. However, due to the size of the application, I can’t post a minimal, reproducible example. I’ll have to break it down piece by piece until I find the issue (which will be outside the scope of this question).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

What I wonder is a good way to poke around it. What could I test and how can I inspect deeper (than the usual consoling out etc.).

The code says precisely this.

console.log('vm', this.vm.rows);
for (let i = 0; i < this.vm.rows.length; i++)
  console.log('forrish', this.vm.rows[i]);
this.vm.rows.forEach(a => console.log('each', a));

I seem to get correct printout on the first line and while looping but not when I iterate. (The same weirdness occur when I use .map(...) too. It’s like iteration causes something. But it makes no sense to me…

enter image description here

>Solution :

Click on the i icon. Chrome shows a popover message that explains logged variables value can be stale.

stale value in console

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading