wixLocation query problem

I am using queryParams to navigate to a specific place in another page of my site and the expand a collapsed item. My wixLocation.to part of the code works as expected, but I cannot manage the expand the collapsed item. Any suggestion would be welcome.

My code in page 1:

export function yearend_click(event) {
    let value = "yearend";
    wixLocation.queryParams.add(
        {"key": value}
    );
    console.log(wixLocation.query);
}

Page 2 code:

$w.onReady( () => {
    if(wixLocation.query.param === "yearend")
    {
        $w("#box93").expand();
        wixLocation.to("/accounting#yearend");
    }
});

In your page 2 code, does any of the code in that if statement fire?

If I console.log it the result is:


The page url is: