From e7b59820cc5bbd8cf0efee918b4690769fd9dceb Mon Sep 17 00:00:00 2001 From: Rick Viscomi Date: Fri, 28 Jun 2024 20:33:02 -0400 Subject: [PATCH 1/4] prerender report pages --- src/js/utils.js | 6 ++++++ templates/base.html | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/js/utils.js b/src/js/utils.js index efbd86bb..3befd892 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -77,6 +77,12 @@ export const drawMetricSummary = (options, client, value, isMedian=true, change= * @param {Function} callback */ export function callOnceWhenVisible(element, callback) { + // If the document is prerendering, don't wait until the charts are visible. + if (document.prerendering) { + callback(); + return; + } + new IntersectionObserver((entries, observer) => { if (!entries[0].isIntersecting) { return; diff --git a/templates/base.html b/templates/base.html index 956b0b7a..b2a43fa3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,6 +35,17 @@ {% block scripts %} + {% endblock %} From f0634da0010ef303da2d2b1c64203df4c6d94614 Mon Sep 17 00:00:00 2001 From: Rick Viscomi Date: Mon, 1 Jul 2024 16:39:18 -0400 Subject: [PATCH 2/4] eager prefetch, moderate prerender --- templates/base.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/templates/base.html b/templates/base.html index b2a43fa3..ac9645ca 100644 --- a/templates/base.html +++ b/templates/base.html @@ -29,6 +29,10 @@ gtag('config', 'G-D66RRD8GF2'); + + + + {% block content %}{% endblock %} @@ -37,12 +41,20 @@ From c0a037286cb5f03fd04cfc747f4649e6af6e7a47 Mon Sep 17 00:00:00 2001 From: Rick Viscomi Date: Mon, 15 Jul 2024 21:02:06 -0400 Subject: [PATCH 3/4] list --- templates/base.html | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/templates/base.html b/templates/base.html index ac9645ca..ba6c42aa 100644 --- a/templates/base.html +++ b/templates/base.html @@ -29,10 +29,6 @@ gtag('config', 'G-D66RRD8GF2'); - - - - {% block content %}{% endblock %} @@ -41,22 +37,13 @@ {% endblock %} From 7a35007a270b597ef0abc57499c1473f372d0f4c Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Sun, 1 Dec 2024 12:01:56 +0000 Subject: [PATCH 4/4] Simplify approach --- src/js/utils.js | 6 ------ templates/base.html | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/js/utils.js b/src/js/utils.js index 3befd892..efbd86bb 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -77,12 +77,6 @@ export const drawMetricSummary = (options, client, value, isMedian=true, change= * @param {Function} callback */ export function callOnceWhenVisible(element, callback) { - // If the document is prerendering, don't wait until the charts are visible. - if (document.prerendering) { - callback(); - return; - } - new IntersectionObserver((entries, observer) => { if (!entries[0].isIntersecting) { return; diff --git a/templates/base.html b/templates/base.html index ba6c42aa..059d29b7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -36,13 +36,19 @@ {% endblock %}