- Merge request !41Issue #3555568: Allow loading HTMX blocks on 404 pages. (1.6.x) → (Open) created by herved
 - Merge request !42Issue #3555568: Allow loading HTMX blocks on 404 pages. (1.5.x) → (Closed) created by herved
 
\Drupal\htmx\Render\HtmxBlockView::build attempts to "Add the simulated request to the top of the stack". This works well on all pages unless we are on a 404 page because \Drupal\Core\Routing\Router::matchRequest throws a ResourceNotFoundException which will fail to load the block.
Context/use case: I'm using HTMX to load the mobile menu block when clicking on the hamburger icon. This works on all pages except a 404 page, where the xhr request to load the block returns 500 Internal Server Error.
PS: This does not seem to be an issue on 403 pages.
- Go on any 404 page
- Attempt to load an HTMX block
- We get a "500 Internal Server Error" response when HTMX attempts to load the block from /htmx/blocks/view/{block}
Add a try/catch on ResourceNotFoundException in HtmxBlockView::build
?
None
None
None
Active
1.6
Drupal Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.