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

Document that HX-Trigger headers are ignored on 302s #2879

Closed
boosh opened this issue Sep 6, 2024 · 4 comments
Closed

Document that HX-Trigger headers are ignored on 302s #2879

boosh opened this issue Sep 6, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@boosh
Copy link

boosh commented Sep 6, 2024

Please clearly document that HX-Trigger won't trigger events on endpoints that return redirects (#2052)

@Telroshan
Copy link
Collaborator

Hey, yep as said in the issue you linked

We never see the 3xx response, that is handled internally by the browser. We only see the eventual 2xx, 4xx or 5xx responses.
So unfortunately we can't do much about this.

So this affects HX-Trigger but really all other headers you might send along a 302 response. This is a common gotcha and could indeed be beneficial to make clearer in the docs.

PRs are always welcome to improve the documentation, if you feel like it!

@MichaelWest22
Copy link
Contributor

Added some documentation around this in a PR for review.

One thing I noticed when testing and reviewing the code for how htmx handles the headers is that we have a couple of duplications in the checking and handling of the HX-Retarget and HX-Reswap headers. see dev...MichaelWest22:htmx:duplicate-header-checks where I tested removing the duplicates and I checked carefully that the first header fetches were indeed not required. No major perf gain removing them just makes the code more readable.

@MichaelWest22
Copy link
Contributor

@boosh updated documentation is now live can you check and close the issue if your happy with it?

@boosh
Copy link
Author

boosh commented Sep 18, 2024

LGTM thanks

@boosh boosh closed this as completed Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants