onReady() triggering twice

This code still triggers onReady twice on preview, even with the ‘work around’ I read in the forum:

import wixWindow from 'wix-window';

$w.onReady(function () {
	if (wixWindow.rendering.env === "browser") {
		console.log("onready");
	}
})

Logging output:

Running the code for the Test page. To debug this code in your browser's dev tools, open gades.js.
onready
Running the code for the Test page. To debug this code in your browser's dev tools, open gades.js.
onready

This makes it very difficult to do much in Velo

Please see the article About the Page Rendering . As the section on Preventing Side Effects states:
" … your global page code and onReady() code will usually run twice, once in the backend and once in the browser. Generally, this is not a problem. In fact, it is used to load your page quicker. "

However, there are scenarios that might result in unwanted side effects. Refer to the above article to get the most out of Velo in your project.

Thanks Yisreal. I’ve read these articles.

If you look at my code i’m using this technique, however the onReady() still runs twice in browser when I preview in Velo