Skip to content

駅名検索確定時に現在地を更新#5277

Merged
TinyKitten merged 2 commits intodevfrom
fix/update-location-when-searched
Feb 14, 2026
Merged

駅名検索確定時に現在地を更新#5277
TinyKitten merged 2 commits intodevfrom
fix/update-location-when-searched

Conversation

@TinyKitten
Copy link
Copy Markdown
Member

@TinyKitten TinyKitten commented Feb 14, 2026

Summary by CodeRabbit

新機能

  • ステーション選択時に位置情報の取得が実装されました。ユーザーがステーションを選択すると、そのステーションの座標と位置情報が自動的に記録されるようになります。

@TinyKitten TinyKitten self-assigned this Feb 14, 2026
@github-actions github-actions Bot added the react label Feb 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

📝 Walkthrough

ウォークスルー

NowHeader コンポーネントにロケーションアトムの統合を追加しました。駅が選択された際に、選択された駅の座標(緯度経度)とデフォルトロケーションオブジェクト(高度など)、現在のタイムスタンプを含むロケーションアトムを更新するロジックを実装しています。

変更内容

コホート / ファイル 概要
ロケーションアトム統合
src/components/NowHeader.tsx
locationAtom のインポートと setLocationAtom セッターの作成。駅選択時にロケーションアトムを座標、高度・精度・方位角・速度などのデフォルト値、タイムスタンプで更新。useCallback の依存配列に setLocationAtom を追加。

推定コードレビュー工数

🎯 2 (Simple) | ⏱️ ~8 minutes

関連する可能性のある PR

  • 位置情報関係のバグを修正 #5273: ロケーションアトムの更新方法を修正する複数の PR。このコミットは駅選択時にロケーションアトムを設定し、関連 PR ではモーダルおよび画面コンポーネント内のロケーション更新・設定フローを追加しています。

ウサギからのポエム

🐰 駅を選んで、位置情報キャッチ!
座標と時刻を一緒に持って、
アトムは踊る、データのリズムで。
小さな変更、大きな流れ。

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは変更内容の主要な部分を正確に説明しており、駅名検索時の現在地更新機能の追加を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/update-location-when-searched

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/NowHeader.tsx`:
- Around line 182-193: The code calls setLocationAtom with
station.latitude/station.longitude cast via "as number" which doesn't prevent
null/undefined; change the update in the NowHeader component to validate that
station.latitude and station.longitude are finite numbers before calling
setLocationAtom (or else call setLocationAtom with coords: null or simply skip
the update). Concretely, in the block that currently calls setLocationAtom,
check Number.isFinite(station.latitude) && Number.isFinite(station.longitude)
and only build the coords object with latitude/longitude when true; otherwise
either set coords to null or return without updating to avoid corrupting
locationAtom.

Comment thread src/components/NowHeader.tsx
@TinyKitten TinyKitten merged commit 1e15dce into dev Feb 14, 2026
6 checks passed
@TinyKitten TinyKitten deleted the fix/update-location-when-searched branch February 14, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant