From 3c71b52f3d6b291ea8cc5160b8fcb9dcfc6fe910 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 12 Jun 2020 16:01:42 -0700 Subject: [PATCH] use acronyms for shorter urls (#21) --- script/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/main.js b/script/main.js index 8128124..65a9d91 100644 --- a/script/main.js +++ b/script/main.js @@ -228,7 +228,7 @@ class App extends Component { debounce(_ => { const url = new URL(location.href); const auditIdValuePairs = Object.entries(metricValues).map(([id, value]) => { - return [metrics[id].auditId, value]; + return [id, value]; }); const params = new URLSearchParams(auditIdValuePairs); params.set('device', device); @@ -287,10 +287,10 @@ function getInitialState() { } // Load from query string. - for (const [id, metric] of Object.entries(metricValues)) { - if (!params.has(metric.auditId)) continue; - const value = Number(params.get(metric.auditId)); - metricValues[id] = value; + for (const [id, metric] of Object.entries(metrics)) { + const value = params.get(id) || params.get(metric.auditId); + if (value === undefined) continue; + metricValues[id] = Number(value); } return {