Commit d83550ac authored by Phil Hughes's avatar Phil Hughes

Merge branch 'fix_performance_bar' into 'master'

Fix performance bar loading issue

See merge request gitlab-org/gitlab!48797
parents 4e20ec6d 31f8a7b8
......@@ -123,11 +123,23 @@ const initPerformanceBar = el => {
});
};
document.addEventListener('DOMContentLoaded', () => {
let loadedPeekBar = false;
function loadBar() {
const jsPeek = document.querySelector('#js-peek');
if (jsPeek) {
if (!loadedPeekBar && jsPeek) {
loadedPeekBar = true;
initPerformanceBar(jsPeek);
}
}
// If js-peek is not loaded when this script is executed, this call will do nothing
// If this is the case, then it will loadBar on DOMContentLoaded. We would prefer it
// to be initialized before the DOMContetLoaded event in order to pick up all the
// requests sent from the page.
loadBar();
document.addEventListener('DOMContentLoaded', () => {
loadBar();
});
initPerformanceBarLog();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment