fix: allow external onChange to override PhoneNumberInput's internal handler#137
fix: allow external onChange to override PhoneNumberInput's internal handler#137jaruesink wants to merge 1 commit into
Conversation
…handler The PhoneNumberInput component was spreading props before its internal onChange and onKeyDown handlers, which prevented external handlers from overriding the internal ones. This caused issues in forms where the parent component needed to manage state updates. By moving the props spread to the end, external onChange handlers can now properly override the internal handler when needed, matching the behavior of other form components like TextField. This fixes the issue where phone number fields would immediately restore their original values when users tried to edit them in forms that manage their own state. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
|
WalkthroughReordered prop spread on the input element in phone-input.tsx so that {...props} is applied later, allowing parent-provided value and handlers to override internal ones. No other logic or public API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant P as Parent
participant C as PhoneInput
participant I as Native Input
P->>C: Render with props (value, onChange, onKeyDown, ...)
C->>C: Prepare internal value/display and handlers
Note over C: Apply props in order<br/>Internal props then {...props}
C->>I: Render input with merged props (parent overrides)
I-->>P: Events (onChange/onKeyDown) handled by parent if provided
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (10)packages/components/src/ui/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
packages/components/src/ui/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
packages/components/src/{remix-hook-form,ui}/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
{apps,packages}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
{apps,packages}/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
packages/components/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
{apps,packages}/**/src/**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
packages/components/src/ui/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
🔇 Additional comments (1)
✨ Finishing touches
🧪 Generate unit tests
Comment |
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
Summary by CodeRabbit