Skip to content

Commit 46b616d

Browse files
authored
Fix page weight and console bugs (#1109)
* Fix page weight bug * Add checks to prevent console errors
1 parent 4b775cd commit 46b616d

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

config/techreport.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -580,35 +580,35 @@
580580
"cards": [
581581
{
582582
"endpoint": "pageWeight",
583-
"category": "images",
583+
"category": "total",
584584
"metric": "median_bytes_formatted",
585-
"label": "Image Weight",
586-
"url": "?weight-over-time=image#page-weight",
585+
"label": "Total Page Weight",
586+
"url": "?weight-over-time=total#page-weight",
587587
"change": "true",
588588
"changeMeaning": "inverted"
589589
},
590590
{
591591
"endpoint": "pageWeight",
592-
"category": "js",
592+
"category": "images",
593593
"metric": "median_bytes_formatted",
594-
"label": "JavaScript Size",
595-
"url": "?weight-over-time=js#page-weight",
594+
"label": "Image Weight",
595+
"url": "?weight-over-time=image#page-weight",
596596
"change": "true",
597597
"changeMeaning": "inverted"
598598
},
599599
{
600600
"endpoint": "pageWeight",
601-
"category": "total",
601+
"category": "js",
602602
"metric": "median_bytes_formatted",
603-
"label": "Total Page Weight",
604-
"url": "?weight-over-time=total#page-weight",
603+
"label": "JavaScript Size",
604+
"url": "?weight-over-time=js#page-weight",
605605
"change": "true",
606606
"changeMeaning": "inverted"
607607
}
608608
]
609609
},
610610
"weight_timeseries": {
611-
"title": "Weight over time",
611+
"title": "Median page weight over time",
612612
"description": "",
613613
"id": "weight_timeseries",
614614
"summary": true,
@@ -666,8 +666,8 @@
666666
"viz": {
667667
"base": "median_bytes_",
668668
"param": "weight-over-time",
669-
"default": "images",
670-
"title": "Image weight over time",
669+
"default": "total",
670+
"title": "Weight over time",
671671
"metric": "median_bytes",
672672
"suffix": "bytes",
673673
"metric_summary": "median_bytes_formatted",
@@ -1026,7 +1026,7 @@
10261026
}
10271027
},
10281028
"weight_timeseries": {
1029-
"title": "Page weight over time",
1029+
"title": "Total page weight",
10301030
"description": "",
10311031
"id": "weight_timeseries",
10321032
"endpoint": "pageWeight",

src/js/techreport/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class TechReport {
406406
// Update drilldown page components
407407
updateDrilldownComponents(data) {
408408
const app = this.filters.app[0];
409-
const icon = data[app].at(-1).icon;
409+
const icon = data[app]?.at(-1)?.icon;
410410
DrilldownHeader.update(this.filters);
411411
DrilldownHeader.setIcon(`${encodeURI(icon)}`);
412412

src/js/techreport/timeseries.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Timeseries {
164164
} else {
165165
/* Add the value to the wrapper */
166166
const valueLabel = document.createElement('p');
167-
valueLabel.textContent = `${latestValue.toLocaleString()}${breakdown.suffix || ''}`;
167+
valueLabel.textContent = `${latestValue?.toLocaleString()}${breakdown.suffix || ''}`;
168168
valueLabel.classList.add('breakdown-value');
169169
itemWrapper.appendChild(valueLabel);
170170
}

templates/techreport/drilldown.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ <h3>{{ tech_report_page.config.weight_summary.title }}</h3>
118118

119119
<div class="card">
120120
{% set timeseries = tech_report_page.config.weight_timeseries %}
121-
{% set selected_subcategory = request.args.get('weight-over-time', '') or tech_report_page.config.weight_timeseries.viz.default or 'performance' %}
121+
{% set selected_subcategory = request.args.get('weight-over-time', '') or tech_report_page.config.weight_timeseries.viz.default or 'total' %}
122122
{% include "techreport/components/timeseries.html" %}
123123
</div>
124124
</div>

0 commit comments

Comments
 (0)