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

Include note about 204 in hx-delete docs and examples #1475

Merged
merged 1 commit into from Jun 7, 2023

Conversation

alexpetros
Copy link
Collaborator

@alexpetros alexpetros commented Jun 3, 2023

Description

This issue has come up in the Discord a few times, as well as on GitHub: #1130

In part because Mozilla suggets a 204 - NO CONTENT status code as an idiomatic response to the DELETE HTTP method, a lot of people come to HTMX (myself included) expecting that returning a 204 will remove the element that sent the delete request from the DOM.

The reason HTMX does not do this is because of an HTMX-wide policy that the 204 response essentially means "do not swap", which is perfectly reasonable once you get to know how the library works. It's also, however, a recurring stumbling block for new users.

I think this can be easily rectified by linking people to the appropriate part of the documentation from the relevant delete pages—since it is reasonably likely they will find the hx-delete or delete row examples before digging into the mildly more obscure section about response codes. It also highlights the increased relevance of status codes in HTMX design patterns, relative to JSON-based patterns.

@1cg 1cg merged commit be1cb53 into bigskysoftware:master Jun 7, 2023
5 checks passed
@alexpetros alexpetros deleted the hx-delete-204-note branch June 7, 2023 21:44
checketts pushed a commit to checketts/htmx that referenced this pull request Jun 19, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants