I have a couple of pages in series with a repeaters where the user should select something from a list. Each item has a Button to select it. On click I want to add the selected object to the url parameters and pass the existing ones and the new ones to the next page where this is applied as filter Criteria to a Dataset.
[...]
$item("#searchButton").onClick(() => {
wixLocation.queryParams.add({
"activity": dataItem.name
});
//<-- With a delay here it works
let url = wixLocation.url;
let params = url.substring(url.indexOf("?"), url.length); //getting all params
console.log("/selectionPage3" + params);
wixLocation.to("/selectionPage3" + params);
[...]
According to the specification none of these functions are asynchronous so the new url should be ready.
If I remove the wixLocation.to line the url is created Correctly. The Logged String represents the Url WITH the query.
When I add the wixLocation.to line again, logged String represents the Url without the query.
Please help.