bigskysoftware / bigskysoftware/_hyperscript

Load event also fires on back button when previous page is still available

Open
#643 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
172
PR merge metrics
No merged PRs in 30d

Description

I have a table that has a header that listens for a `load` event to fetch its contents using HTMX. The table is then full of links that are `hx-boost`ed.

When these links are clicked, they navigate to a new page. Now, when pressing the back button, the table is still visibly loaded/the page has been cached (on first load the table is blank), but the `load` event is refired and the table is unnecessarily re-fetched.

Is there a way to filter these out and only fetch the table on "true" loads?

https://github.com/user-attachments/assets/7554133d-4c8b-4ef4-b6a7-71529b703a5d

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported sequence: an HTMX-loaded table, hx-boosted links, navigation to another page, and the browser back button. Observe whether the load event fires while the cached table is visible and determine the project entry point responsible. Done means the table is not unnecessarily refetched on back navigation while still loading on a true initial load.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.