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

Fix URL Params Appending on Boost #1811

Conversation

Rounak-stha
Copy link

This PR fixes #1788.
The change simply takes the URL part without any query params when AJAX request is issued on boosted element.
In case of anchor tags, the href value simply provides the requested URL but in case of forms, the location object is used to get the current href value.

Should this change include a test?
If yes then can somebody help me with that?

@alexpetros alexpetros added the bug Something isn't working label Sep 19, 2023
@@ -3102,7 +3102,7 @@ return (function () {

// behavior of anchors w/ empty href is to use the current URL
if (path == null || path === "") {
path = getDocument().location.href;
path = getDocument().location.href.split('?')[0];
Copy link
Contributor

@xhaggi xhaggi Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the above comment indicates, this is also applied to anchors with an empty href attribute and that change would be a change in behavior. Not sure if we should fix it here or better move it to

htmx/src/htmx.js

Line 1372 in 7274454

path = getRawAttribute(elt, 'action');

@alexpetros alexpetros changed the title #1788 Fix URL Params Appending on Boost Fix URL Params Appending on Boost Nov 6, 2023
@knpwrs
Copy link

knpwrs commented Dec 1, 2023

I've just started looking into possibly using HTMX and noticed this behavior in my trials. It would be really great to get this or another fix merged!

@alexpetros
Copy link
Collaborator

We can't merge this into the core right now because we are going to refactor this section of it.

This is also a big change—would love to see this as an extension first, and we'd be happy to link to it. It's not impossible this could be in the core eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] hx-boost: form with get method keeps appending param in the URL
4 participants