Skip to content
Discussion options

You must be logged in to vote

yes wrap the statements in an immediately invoked function so the whole thing is one expression my earlier example missed that wrapper

let n = selected.get();
raw!(r#"(() => {
    const url = new URL(window.location.href);
    url.searchParams.set("c", ${n});
    history.replaceState(history.state, "", url);
})()"#)

your second version changes one URL object then passes a fresh unchanged object to replaceState this keeps the same object throughout i checked the javascript expression and preservation of other query parameters in node but have not run the topcoat app

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jimbrankelly
Comment options

@morvayo
Comment options

Answer selected by jimbrankelly
@jimbrankelly
Comment options

@jimbrankelly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants