Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Updating / removing query params from the url #458

Open
rdehuyss opened this issue Aug 2, 2023 · 0 comments
Open

[Feature request] Updating / removing query params from the url #458

rdehuyss opened this issue Aug 2, 2023 · 0 comments

Comments

@rdehuyss
Copy link

rdehuyss commented Aug 2, 2023

Hi there,

Again - I want to express my ❤️ for _hyperscript!

One thing I'm struggling with is removing a query parameter from the url. I tried lots of things but this is what I ended up with:

<button class="modal-close is-large"
            _="on click remove #company-edit-modal
                js
                    window.history.pushState({}, document.title, window.location.pathname);
                end"
            aria-label="close"></button>

My journey started as follows:

<button class="modal-close is-large"
            _="on click log the location of window
                then set newLocation to the location of window
                then log newLocation.origin + newLocation.pathname
                then set newLocationUrl to newLocation.origin + newLocation.pathname
                then log newLocationUrl
                then go to url #(newLocationUrl)
            "
            aria-label="close"></button>

I just want to update the url and not navigate so according to the docs it should be possible by prepending it with a hash. However, this does not appear to be working with variables.

But how cool 😎 would the following be:

<button class="modal-close is-large"
            _="on click remove #company-edit-modal then remove query param 'view' from the url"
            aria-label="close"></button>

I tried a lot of the combinations above but none worked so I assume this is not implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant