Skip to content

Commit

Permalink
perf: reduce url length
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Apr 7, 2024
1 parent 210283d commit 796f9e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ function updateDatasets() {
}

function updateURL() {
window.location.hash = `#ref=${ref}&interval=${interval}&granularity=${granularity}&downloadType=` + encodeURIComponent(downloadType);
const params = new URLSearchParams();
params.set("ref", ref);
if (interval !== "infinity") params.set("interval", interval);
if (granularity !== 1) params.set("granularity", granularity);
if (downloadType !== "installs+updates") params.set("downloadType", downloadType);
window.location.hash = '#' + params.toString();
}

async function refHandler(event) {
Expand Down

0 comments on commit 796f9e6

Please sign in to comment.