From 0ee5d5a773e4867bbebd8358674e7f26a449b998 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Thu, 12 Dec 2019 13:57:45 -0800 Subject: [PATCH] move type check --- .../report/html/renderer/details-renderer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lighthouse-core/report/html/renderer/details-renderer.js b/lighthouse-core/report/html/renderer/details-renderer.js index c71637a3744e..23efeea5c262 100644 --- a/lighthouse-core/report/html/renderer/details-renderer.js +++ b/lighthouse-core/report/html/renderer/details-renderer.js @@ -331,13 +331,11 @@ class DetailsRenderer { } /** - * @param {LH.Audit.Details.TableItem} row + * @param {LH.Audit.Details.Value[]} values * @param {LH.Audit.Details.OpportunityColumnHeading} heading * @return {Element?} */ - _renderSubRows(row, heading) { - const values = row[heading.key]; - if (!Array.isArray(values)) return null; + _renderSubRows(values, heading) { const subRowsElement = this._dom.createElement('div', 'lh-sub-rows'); for (const childValue of values) { const subRowElement = this._renderTableValue(childValue, heading); @@ -388,7 +386,9 @@ class DetailsRenderer { displayUnit: heading.subRows.displayUnit || heading.displayUnit, label: '', }; - const subRowsElement = this._renderSubRows(row, subRowsHeading); + const values = row[subRowsHeading.key]; + if (!Array.isArray(values)) continue; + const subRowsElement = this._renderSubRows(values, subRowsHeading); if (subRowsElement) valueFragment.appendChild(subRowsElement); }