Understand When Pega Page is Truly Loaded
Sometimes JS ready event executes when Pega is still working hard to display the page.
To not rely on it you can check for document-statetracker element in DOM, but also there is a JS property pega.ui.statetracking where you can see what exactly is loading right now.
There is no public docs on it from Pega side on it.