Fix query sharing with 1 checked item.

This commit is contained in:
Mario Zechner 2023-06-01 20:08:24 +02:00
parent 4a6b8bb225
commit c34be43048
1 changed files with 2 additions and 1 deletions

View File

@ -448,7 +448,8 @@ function newSearchComponent(parentElement, items, searched, filter, headerModifi
queryLink.classList.remove("hide");
jsonLink.classList.remove("hide");
const inputs = [...table.querySelectorAll("input:checked")];
const checked = inputs.length ? inputs.map(item => item.dataset.id) : getQueryParameter("c");
let checked = inputs.length ? inputs.map(item => item.dataset.id) : getQueryParameter("c");
if (typeof checked === "string") checked = [ checked ];
queryLink.setAttribute("href", `/?q=${encodeURIComponent(query)}${checked?.length ? `&c=${checked.join("&c=")}` : ""}`)
};