You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some requests issued when navigating to a page (e.g. getting an image) are issued again when leaving the page by clicking on a link to navigate to another page, using hx-boost.
Navigate between page1.php and page2.php, multiple times, with JS/htmx enabled, then disabled
Actual
With JS/htmx: a request to stream.php is issued each time (when navigating to and from page1.php), even if only page1.php has the <img> tag ❌
Without JS/htmx: the request to stream.php is only issued when navigating to page1.php ✔️
Expected
The request to stream.php should only be issued when navigating to (and not from) page1.php, in both cases.
➡️ Using hx-boost shouldn't trigger additional requests. Does htmx DOM manipulation is responsible for triggering these requests? On pages with many resources (multiple <img> elements), this can lead to a lot of useless additional requests to be sent. Can we prevent this?
Some more things I've tested
Disabling the cache doesn't seem to solve the problem (historyCacheSize = 0, historyEnabled = false)
Using @hotwired/turbo (instead of htmx + hx-boost), with prefetch disabled (turbo-prefetch = false):
With cache enabled (default): the same issue happens
With cache disabled (turbo-cache-control = no-cache): the issue disappears
Environment
htmx: 1.9.12 (from CDN or from NPM + bundled using Vite)
Browser: Firefox 127, Chrome 125
Backend: Go/Echo, PHP
OS: Windows 11
PS: thanks for this great library!
The text was updated successfully, but these errors were encountered:
Some requests issued when navigating to a page (e.g. getting an image) are issued again when leaving the page by clicking on a link to navigate to another page, using
hx-boost
.Steps to reproduce
php -S localhost:8000
page1.php
andpage2.php
, multiple times, with JS/htmx enabled, then disabledActual
stream.php
is issued each time (when navigating to and frompage1.php
), even if onlypage1.php
has the<img>
tag ❌stream.php
is only issued when navigating topage1.php
✔️Expected
The request to
stream.php
should only be issued when navigating to (and not from)page1.php
, in both cases.➡️ Using
hx-boost
shouldn't trigger additional requests. Does htmx DOM manipulation is responsible for triggering these requests? On pages with many resources (multiple<img>
elements), this can lead to a lot of useless additional requests to be sent. Can we prevent this?Some more things I've tested
historyCacheSize = 0
,historyEnabled = false
)@hotwired/turbo
(instead of htmx +hx-boost
), with prefetch disabled (turbo-prefetch
=false
):turbo-cache-control
=no-cache
): the issue disappearsEnvironment
PS: thanks for this great library!
The text was updated successfully, but these errors were encountered: