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

Open
#643 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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-boosted.

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

Dominant language
JavaScript
Stars
3.8k
Forks
171
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bigskysoftware/_hyperscript

All issues in bigskysoftware/_hyperscript

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.