Gallery search and filters stop working after you come back to /templates through a site link
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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>.
- Ngôn ngữ chính
- TypeScript
- Star
- 8
- Fork
- 4
- Merge trung bình
- 5 giờ 44 phút
- Pull request đã merge (30 ngày)
- 83
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/ogcops
-
Add the Order Status e-commerce template (`ecommerce-order-status`)Có thể đã có người làm @piyusshhjangid đã nhận 1 ngày trước. Đang mởgood first issue hacktoberfest templates
codercops/ogcops#181 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Cheat Sheet tutorial template (`tutorial-cheat-sheet`)Có thể đã có người làm @srikar-naidu đã nhận 1 ngày trước. Đang mởhacktoberfest help wanted templates
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
codercops/ogcops#180 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Call for Speakers event template (`event-call-for-speakers`)Có thể đã có người làm @Saifjafri212213 đã nhận 1 ngày trước. Đang mởgood first issue hacktoberfest templates
codercops/ogcops#177 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Day Streak developer template (`developer-day-streak`)Có thể đã có người làm @srikar-naidu đã nhận 1 ngày trước. Đang mởhacktoberfest help wanted templates
codercops/ogcops#176 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/ogcops
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Nimblesite/SharpLsp#468 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bundled uv is never updated and trusts the compromised eMudhra certificatesCó thể đã có người làm @FabienDanieau đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bg_wait's blocking mode (stopOnAttention: false) is under-documented and effectively undiscoverableĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nicobailon/pi-subagents#3019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
db-ux-design-system/core-web#8613 ·
Maintainer thường phản hồi trong vòng 1 ngày