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

Chained HX-Location responses pushes the urls in reverse. #3045

Open
bolu61 opened this issue Nov 28, 2024 · 0 comments
Open

Chained HX-Location responses pushes the urls in reverse. #3045

bolu61 opened this issue Nov 28, 2024 · 0 comments

Comments

@bolu61
Copy link

bolu61 commented Nov 28, 2024

When chaining HX-Location redirects, the urls are pushed in reverse order.

In handleAjaxResponse, which is also called when the next request started by ajaxHelper resolves:

htmx/src/htmx.js

Lines 4645 to 4647 in 24fb2fe

ajaxHelper('get', redirectPath, redirectSwapSpec).then(function() {
pushUrlIntoHistory(redirectPath)
})

Each request's promise only resolves when the request started by the redirect is resolved. So the newer request will have pushed it's url before the request that started the redirection pushes its url.

Url should be pushed before the handling the next response.

@bolu61 bolu61 changed the title Chained HX-Location pushes the urls in reverse. Chained HX-Location responses pushes the urls in reverse. Nov 28, 2024
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