wixLocation.queryParams.add not synchronous

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.

I found a Solution:

I added a separate handler that redirects the user on change of the Params.
This is a little annoying as I wanted to add multiple params on some sites and now I have to explicitly filter on the change of params to not trigger the move to the next page on every change… but I can work with that.

wixLocation.onChange((handler) => {
let url = wixLocation.url
let params = url.substring(url.indexOf("?"), url.length)
console.log("/toernkalender" + params);
wixLocation.to("/toernkalender" + params)
})