refactor(nav): unify section-id vocabulary + make off-route detection explicit
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- next.js, typescript
- 領域
- frontend
調査の方向性
Read lib/scroll.ts, components/site/Chrome.tsx, and components/site/MobileMenu.tsx, then trace how section IDs and route checks are used in both navigation paths. Decide how to centralize the section ID types and distinguish a route mismatch from a missing target. Done when both proposals are handled explicitly and the navigation behavior is covered by tests.
索引モデルが issue の本文から書いたものです。
説明
Follow-up from the PR #159 review (fix #157). Two related, non-blocking improvements deferred out of that bugfix's scope.
1. Unify the section-id vocabulary
"intro" and the section-id set are currently declared in three unrelated places with no compile-time link:
lib/scroll.ts—HOME_SECTION_ID = "intro"components/site/Chrome.tsx—SECTION_IDS = ["intro", "compare", "method", "faq", "contact"]components/site/MobileMenu.tsx—type SectionId = "intro" | "compare" | ...
Renaming the hero section id today means editing three files in lockstep with no type error to catch a miss.
Proposal: export a single SectionId union + SECTION_IDS tuple from lib/ (e.g. lib/scroll.ts or a sibling), import it in both components, and define HOME_SECTION_ID as a member of it. HomeNavTarget's section.id could then narrow to Exclude<SectionId, typeof HOME_SECTION_ID>. Touches the active-section observer typing in Chrome.tsx, so it's a deliberate refactor rather than a one-liner.
2. Make the off-route discriminator explicit
Both nav codepaths decide "am I off-route?" by element absence:
components/site/Chrome.tsx:70—if (document.getElementById(HOME_SECTION_ID) === null) return;components/site/MobileMenu.tsxcleanup —if (anchor && !targetEl) window.location.assign(...)
Correct today because every nav target is a synchronously-rendered home section and the Hero always mounts on /. But the check can't distinguish "wrong route" from "right route, target not mounted": a future lazy/Suspense-mounted target tapped on the home page would be misread as off-route and silently hard-reload (and the desktop return path could become a no-op dead-click if the Hero ever failed to mount).
Proposal: key the off-route branch on actual route mismatch (e.g. via usePathname(), already used in Chrome.tsx) rather than element absence, and/or extract a small testable isOnHomeRoute() / resolveLocalTarget() helper so the off-route-vs-missing distinction is explicit and unit-testable.
Both surfaced by the multi-agent review on #159; neither is a live bug.
- 主要言語
- TypeScript
- スター
- 3
- フォーク
- 0
- 平均マージ
- 12時間 52分
- マージ済み PR(30日)
- 69
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
decdn/website のほかの issue
-
bug med-priority
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement low-priority
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
decdn/website#268 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
dependencies javascript low-priority revisit
難易度 2/5 1〜3時間 初心者へのやさしさ 15/100
decdn/website#235 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation low-priority
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
decdn/website#136 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:editor bug issue-form:bug P0 platform:windows review: low
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
1lck/Lithe-IDEA#1388 ·
メンテナーはふだん 1 日以内に返信
-
fix(api): isToolAuditEnabled swallows database read errors on auditToolOperations without loggingオープンarea: backend bug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
snapotter-hq/SnapOtter#3238 ·
メンテナーはふだん 1 日以内に返信
-
rig up --plan times out after 5 s and reports an UNKNOWN outcome while the daemon completes the planオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/servers#5216 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信