Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe pull request extends Google Places autocomplete and ref-based validation support to the pickup address field, mirroring the existing destination address handling in the agency form and interactive area components. This includes adding ref binding, validation state management, autocomplete integration, and updated form synchronization logic. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AgencyInteractiveArea
participant AgencyForm
participant GooglePlaces
participant MantineForm
User->>AgencyForm: Types in pickup address input
AgencyForm->>AgencyInteractiveArea: Input event via ref
AgencyInteractiveArea->>GooglePlaces: Validate with Google Places API
GooglePlaces-->>AgencyInteractiveArea: Return geometry validation
AgencyInteractiveArea->>AgencyInteractiveArea: Set validationPickupAddressGood state
AgencyInteractiveArea->>MantineForm: Write pickupAddress to form via setFieldValueRef
AgencyInteractiveArea->>User: Display validated pickup address
User->>AgencyForm: Clicks submit
AgencyForm->>AgencyInteractiveArea: Trigger submit handler
AgencyInteractiveArea->>AgencyInteractiveArea: Check validationPickupAddressGood
alt Validation Passes
AgencyInteractiveArea->>MantineForm: Read form.values (pickup & destination)
MantineForm-->>AgencyInteractiveArea: Return address values
AgencyInteractiveArea->>User: Submit booking with addresses
else Validation Fails
AgencyInteractiveArea->>AgencyForm: Set field error for pickupAddress
AgencyInteractiveArea->>User: Display validation error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 the current code and only fix it if needed.
Inline comments:
In `@src/app/_components/agencycomponents/agency-interactive-area.tsx`:
- Around line 225-275: The effect currently depends on
pickupInputElement.current and removes listeners using the ref at cleanup time,
which can detach the wrong element; capture the DOM element in a local const
(e.g., const el = pickupInputElement.current) and use that local variable for
mounting, adding the input listener (pickupInputElementOnInput), and for cleanup
(removeEventListener), and likewise capture googleAutoCompleteElement locally
for clearing its listeners; replace pickupInputElement.current in the dependency
array with stable props like showBookingModal and isLoaded (also update the
inputElement effect the same way) and ensure you still call
setFieldValueRef.current("pickupAddress", el.value ?? "") when handling
place_changed so you reference the captured element.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 17db6a0f-5231-4e04-a408-48fcbbe1e356
📒 Files selected for processing (2)
src/app/_components/agencycomponents/agency-form.tsxsrc/app/_components/agencycomponents/agency-interactive-area.tsx
Changes
Summary by CodeRabbit