bigskysoftware / bigskysoftware/_hyperscript

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

オープン
#643 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
3.8k
フォーク
172
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、報告された一連の操作を再現します。HTMX で読み込まれるテーブル、hx-boosted リンク、別のページへの移動、そしてブラウザーの戻るボタンです。キャッシュされたテーブルが表示されている間に load event が発火するかを確認し、その原因となるプロジェクトのエントリポイントを特定します。戻るナビゲーションでテーブルが不必要に再取得されず、真の初回ロードでは引き続き読み込まれれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend, web-dev
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。