From f3f777818c5a94cc37b8c69d4991e02790db2ae7 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Thu, 17 Mar 2022 12:03:48 -0700 Subject: [PATCH] Never show an empty table of contents This doesn't seem to have got updated when we revised the data format in T299065. Bug: T303860 Change-Id: Ib955950e014668fe434da4a1654e977eb43f7dd8 --- includes/SkinVector.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 666de46c..b617b188 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -682,7 +682,9 @@ class SkinVector extends SkinMustache { * @return array */ private function getTocData( array $tocData ): array { - if ( empty( $tocData ) ) { + // If the table of contents has no items, we won't output it. + // empty array is interpreted by Mustache as falsey. + if ( empty( $tocData ) || empty( $tocData[ 'array-sections' ] ) ) { return []; }