Gallery search and filters stop working after you come back to /templates through a site link
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
The gallery's search box and category pills stop working once you come back to /templates through a link on the site. On https://og.codercops.com:
- Open
/templates. Typing "dark" filters the gallery, and the GitHub pill shows 10 templates. - Click "Preview" in the header, then "Templates".
- Type "dark" or click a category pill. All 110 templates stay on screen, the "Showing" line doesn't change, and there's no error in the console.
The site uses Astro's <ClientRouter /> (src/layouts/Layout.astro, line 75), so links inside the site swap the page without a full reload. The router runs each script once until the next full reload: it remembers scripts by their text and skips any it has already run, unless the script has data-astro-rerun. The gallery's code is a top-level <script is:inline> (src/pages/templates.astro, lines 80 to 163), so the second time the page is shown, nothing attaches listeners to the new search box and pills, and ?q= and ?category= aren't read either.
What to do
- Put the gallery setup in a function and run it on
astro:page-load, which fires on the first load and after every navigation.Layout.astrodoes this for the scroll animations (line 107). - The event fires on every page, so return early when the gallery isn't on the page.
- Attach the listeners once per visit to
/templates, not once more for every navigation. - If you'd rather add
data-astro-rerun, wrap the code in a function first: run twice, the script's top-levelconsts would be declared twice and it would throw. - Keep the search matching names, descriptions and tags (#147), and keep
?q=and?category=working.
Where to look
src/pages/templates.astro: the script at lines 80 to 163src/layouts/Layout.astro:<ClientRouter />(line 75) and theastro:page-loadlistener (line 107)src/components/Header.astro(line 11) andsrc/components/Footer.astro(line 20) link to/templates
Acceptance criteria
- After going from
/templatesto another page and back with the header or footer link, the search box and the category pills filter the gallery, and the "Showing" line updates - Going back and forth several times still works, without adding another set of listeners each time
- Opening
/templates?q=dark&category=githubdirectly still applies both -
npm run check,npm run testandnpm run buildpass - The PR says how you tested the navigation in a browser with
npm run dev
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>.
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 4
- 平均マージ
- 6時間 9分
- マージ済み PR(30日)
- 66
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/ogcops のほかの issue
-
accessibility bug good first issue hacktoberfest ui
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
accessibility bug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest ui
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
codercops/ogcops#167 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
An empty `imageUrl=`, `logoUrl=` or `template=` returns an error instead of the default対応中かも @Saifjafri212213 が今日担当しました。 オープンbug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
codercops/ogcops#166 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
codercops/ogcops の issue をすべて見る
似ている issue
-
agent/scanner help wanted hive/claimed-by-scanner kind/bug stage/020-claimed
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
hivecommons/rationguard#315 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area: ui-sdk priority: p3 type: chore
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
schlessera/brain-kit#2534 ·
メンテナーはふだん 1 日以内に返信
-
bug lane:gh-5
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
LLM-4-People/bridlewise-testing#122 ·
メンテナーはふだん 1 日以内に返信
-
bug priority: P2
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信