From 65cc438dfbd1b55dea24e75615515637e44d4e81 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Wed, 19 Jul 2023 13:37:34 -0400 Subject: [PATCH 1/4] add waiting notice and support missing script --- output/html/web_vitals.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/output/html/web_vitals.php b/output/html/web_vitals.php index f3241a38b..c8443dd69 100644 --- a/output/html/web_vitals.php +++ b/output/html/web_vitals.php @@ -34,6 +34,15 @@ public function name() { * @return void */ public function output() { + if ( ! wp_script_is( 'web-vitals', 'enqueued' ) && ! wp_script_is( 'web-vitals', 'done' ) ) { + $this->before_non_tabular_output(); + /* translators: %s: Script handle. */ + $notice = sprintf( __( 'Script %s is not available.' ), 'query-monitor' ), 'web-vitals' ); + echo $this->build_notice( $notice ); + $this->after_non_tabular_output(); + return; + } + $this->before_tabular_output(); echo ''; @@ -47,19 +56,24 @@ public function output() { echo ''; echo ''; + echo ''; + echo ''; + echo '

Waiting for data...

'; + echo ''; + echo ''; echo ''; $this->after_tabular_output(); echo '