Jiseoup/showmycodePublic
EN|KO
  • 코드
  • 커밋
  • 풀 리퀘스트
← 목록으로
Merged

fix: preserve query params when switching locale

#22
JiseoupJiseoup · 2026년 6월 16일fix/locale-switch-preserve-query → main
fix
개요커밋변경된 파일

What & Why

Switching the language dropped the URL query string, because LangSwitcher built the target href from pathname alone. On a PR detail page this lost the ?tab= param and reset the view to Overview; commit pagination(?page=) and the file viewer's ?path=/?branch= were lost the same way.

Fixed by reading the current query via useSearchParams and re-appending it, isolated behind a Suspense boundary so prerendered routes stay static.

Related Issue

N/A

How to Verify

  1. Open any PR detail page, switch to the Commits or Files changed tab.
  2. Click EN/KO in the language switcher → stays on the same tab (previously reset to Overview).
  3. On a commits list at ?page=2, switch locale → still on page 2.
  4. In the file viewer with a file open on a non-default branch, switch locale → ?path= and ?branch= retained.

Checklist

  • PR title follows Conventional Commits (feat:, fix:, chore:, refactor:, docs:, i18n:)
  • Translations added to both locales/ko.json and locales/en.json (if UI text changed)
  • Tested on mobile viewport (if UI changed)