Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use acronyms for shorter urls #21

Merged
merged 2 commits into from
Jun 12, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions script/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -283,10 +283,11 @@ function getInitialState() {
}

// Load from query string.
for (const [id, metric] of Object.entries(metricValues)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke the URL loading. should have been metrics not 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 {
Expand Down