fix: default max detour to 5 minutes#57
Conversation
Show only worthwhile stops by default — maxDetour now starts at 5 min (and resets to 5 on fuel change) instead of "no limit". Users can still widen it via the slider. Adds autocomplete/search-panel regression tests for dropdown-closes-on-select.
📝 WalkthroughWalkthroughThe PR changes the default detour time constraint in the home client from ChangesDefault detour constraint
Autocomplete dropdown closure tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/search/autocomplete-input.test.tsx`:
- Around line 10-15: The test constant RESULT is missing the
PhotonResult.country property and is being force-cast with "as PhotonResult", so
update the object literal for RESULT to include country: null explicitly (and
remove the unnecessary type assertion if preferred) so the value matches the
PhotonResult shape in strict mode; refer to the constant name RESULT and the
PhotonResult type to locate and fix the object definition in
autocomplete-input.test.tsx.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b2b8adac-450d-4dd3-a213-e48583f4e13b
📒 Files selected for processing (3)
src/components/home-client.tsxsrc/components/search/autocomplete-input.test.tsxsrc/components/search/search-panel.test.tsx
| const RESULT: PhotonResult = { | ||
| name: "Madrid", | ||
| city: "Madrid", | ||
| state: "Comunidad de Madrid", | ||
| coordinates: [-3.7, 40.4], | ||
| } as PhotonResult; |
There was a problem hiding this comment.
Explicitly declare country: null to satisfy strict mode.
The as PhotonResult cast bypasses TypeScript's requirement that all properties be explicitly present in strict mode. The country field is omitted, so at runtime it will be undefined rather than null.
🔧 Proposed fix
const RESULT: PhotonResult = {
name: "Madrid",
city: "Madrid",
state: "Comunidad de Madrid",
+ country: null,
coordinates: [-3.7, 40.4],
} as PhotonResult;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/search/autocomplete-input.test.tsx` around lines 10 - 15, The
test constant RESULT is missing the PhotonResult.country property and is being
force-cast with "as PhotonResult", so update the object literal for RESULT to
include country: null explicitly (and remove the unnecessary type assertion if
preferred) so the value matches the PhotonResult shape in strict mode; refer to
the constant name RESULT and the PhotonResult type to locate and fix the object
definition in autocomplete-input.test.tsx.
Summary
maxDetournow defaults to 5 min (was "no limit") on initial load and resets to 5 on fuel change, so users see only worthwhile stops by default. The slider still goes up to "no limit".Test plan
Summary by CodeRabbit
Bug Fixes
Tests