From f9a8316808b55a574b89fcf500db341e0b6cfd3e Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 12 Jun 2020 15:44:20 -0700 Subject: [PATCH 1/2] use acronyms for shorter urls --- script/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/script/main.js b/script/main.js index 9fa903a..f19aa8f 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); @@ -283,10 +283,11 @@ 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); + console.log(value, id, metric) + if (value === undefined) continue; + metricValues[id] = Number(value); } return { From ddecc7a4aa1466207495fb955368b06ec80195b0 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 12 Jun 2020 15:45:25 -0700 Subject: [PATCH 2/2] fix --- script/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/script/main.js b/script/main.js index f19aa8f..649e39e 100644 --- a/script/main.js +++ b/script/main.js @@ -285,7 +285,6 @@ function getInitialState() { // Load from query string. for (const [id, metric] of Object.entries(metrics)) { const value = params.get(id) || params.get(metric.auditId); - console.log(value, id, metric) if (value === undefined) continue; metricValues[id] = Number(value); }