fix(auth): keep a link's fragment through sign-in
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nextjs, react, typescript
調査の方向性
Start by reading src/lib/auth/redirect.ts around line 58 to see how safeNextPath already carries a fragment, then src/app/sign-in/page.tsx:58-108 to see how next is bound to the signInWithGitHub Server Function. The missing piece is in src/app/sign-in/sign-in-form.tsx: read window.location.hash and pass it with the form so the server composes path plus fragment before safeNextPath, keeping the 512 character limit. Add cases to src/lib/auth/redirect.test.ts with and without a fragment, then run npx vitest run src/lib/auth/redirect.test.ts plus lint and typecheck; done means a signed-out visit to /w/<slug>/alerts/settings#alert-emails lands on the heading after sign-in.
索引モデルが issue の本文から書いたものです。
説明
Context
A signed-out reader who opens an app link with a fragment loses the fragment in sign-in, so they land on the right page but not on the section the link named.
Path, read from the code (raised in review of #354, thread https://github.com/eddiejaoude/DevMacro/pull/354#discussion_r4548573349):
- The browser asks for
/w/<slug>/alerts/settings#alert-emails(the link in every alert email after #343), or/w/<slug>/alerts#alert-emails(every alert email sent before it). The fragment never reaches the server. src/proxy.ts:199-202sees no session and redirects to/sign-in?next=..., buildingnextfrompathnameandsearchonly.- The browser carries
#alert-emailsonto/sign-in, but the sign-in form posts the Server FunctionsignInWithGitHub(src/app/sign-in/page.tsx:58-87) with thenextbound on the server (page.tsx:108), which starts a new navigation to GitHub. The fragment is gone from here on. /auth/callbackredirects tonext, so the reader lands on the page with no fragment.
For the old /alerts#alert-emails links this means the reader stays on the inbox, because MovedSettingsRedirect (#343) only forwards a settings fragment it can see. For the new links it means alert settings opens at the top instead of at Alert emails. That is the path for any alert email opened on a phone or in a browser with no session.
safeNextPath already keeps a fragment (src/lib/auth/redirect.ts:58, covered by redirect.test.ts:11), and /auth/callback and /auth/confirm pass next through it, so only the step that builds next in the browser is missing.
Plan
- In
src/app/sign-in/sign-in-form.tsx, readwindow.location.hashin the browser and send it with the form (for example a hidden field the Server Function reads), sosignInWithGitHubbuildsnextas the bound path plus the fragment. - Pass the combined value through
safeNextPathon the server as today, so a fragment cannot widen whatnextmay target, and keep the 512 character limit. - Leave
src/proxy.tsas it is: a fragment cannot be read there.
Acceptance criteria
- Signed out, opening
/w/<slug>/alerts/settings#alert-emailsand signing in ends on alert settings with the Alert emails heading in view and focused. - Signed out, opening
/w/<slug>/alerts#alert-emailsand signing in ends on alert settings at Alert emails (the #343 forward runs after sign-in). - A link with no fragment signs in to the same page as today, and a
nextwith a fragment still falls back to/appwhen the path is not an app path. - Unit tests for building
nextwith and without a fragment, including the length limit. - Playwright e2e coverage for the signed-out round trip, or a note saying why the GitHub step cannot be driven in e2e and what covers it instead.
Files and areas
src/app/sign-in/sign-in-form.tsx,src/app/sign-in/page.tsx,src/lib/auth/redirect.tsand its tests, an e2e spec undere2e/.- Non-goals: changing the proxy redirect, the OAuth provider, or what
safeNextPathaccepts.
Verification
npx vitest run src/lib/auth/redirect.test.ts, the sign-in e2e spec through the guarded runner, npm run lint, npm run typecheck.
Branch: <issue-number>-sign-in-keeps-fragment
Closes with a Closes #<issue-number> footer on the commit or pull request.
Model: anthropic/claude-opus-5-5 | Reasoning effort: medium
- 主要言語
- TypeScript
- スター
- 1
- フォーク
- 1
- 平均マージ
- 6時間 56分
- マージ済み PR(30日)
- 136
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
eddiejaoude/StackDash のほかの issue
-
area: docs documentation priority: P3 size: S
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
eddiejaoude/StackDash#462 ·
メンテナーはふだん 1 日以内に返信
-
area: web bug priority: P3 size: XS
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
eddiejaoude/StackDash#432 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: database bug priority: P3 size: S
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eddiejaoude/StackDash#419 ·
メンテナーはふだん 1 日以内に返信
-
area: docs bug priority: P2 size: XS
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
eddiejaoude/StackDash#418 ·
メンテナーはふだん 1 日以内に返信
-
accessibility area: timeline bug priority: P3 size: XS
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
eddiejaoude/StackDash#389 ·
メンテナーはふだん 1 日以内に返信
eddiejaoude/StackDash の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-webui/tether#52 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
voidzero-dev/void#835 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AykutSarac/jsoncrack.com#616 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
melgarafael/DeskcommCRM#4679 ·
メンテナーはふだん 1 日以内に返信