Sometimes when I load my website, this message appears in the console:
Why is this shown? Aren't my JS code optimized enough? And what should I do now?
Sometimes when I load my website, this message appears in the console:
Why is this shown? Aren't my JS code optimized enough? And what should I do now?
reflow
is the name of the web browser process for re-calculating the positions and geometries of elements in the document, for the purpose of re-rendering part or all of the document.
Your Browser stops the execution of the script because reflow
is user-blocking
Take a look at this List of what operations force reflow: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
You can read all about it here.
Violation Long running JavaScript task took xx ms
See the answers to get to know what it is and why the warning shows up.
To trace the cause, I would recommend you employ Binary search technique and keep dividing your java-script code and commenting them till you get to the line/lines which are causing this problem.