-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed : Newly Added Patient Is Not Instantly Visible in the patient-switcher | Patient search bar auto focus #10736
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request enhances two key components. In the Changes
Sequence Diagram(s)sequenceDiagram
participant Component as SearchByMultipleFields
participant PhoneInput as PhoneInput Field
participant Hook as useEffect Hook
Component->>PhoneInput: Render with autoFocus prop (if true)
Hook->>PhoneInput: Focus the input when autoFocus is true
sequenceDiagram
participant UI as PatientRegistration Component
participant Mutation as createPatient Operation
participant Cache as Query Cache
participant Storage as Local Storage
UI->>Mutation: Submit patient data
Mutation->>UI: Return created patient data
UI->>Cache: Invalidate "patients" query
UI->>Storage: Store patient info under "selectedPatient"
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/pages/PublicAppointments/PatientRegistration.tsx (1)
185-185
: Consider adding error handling for localStorage operations.While storing the selected patient follows the existing pattern, it's good practice to wrap localStorage operations in try-catch blocks to handle potential errors (e.g., when storage is full or disabled).
- localStorage.setItem("selectedPatient", JSON.stringify(data)); + try { + localStorage.setItem("selectedPatient", JSON.stringify(data)); + } catch (error) { + console.error("Failed to store selected patient:", error); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/Common/SearchByMultipleFields.tsx
(1 hunks)src/pages/PublicAppointments/PatientRegistration.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Test
- GitHub Check: cypress-run (1)
- GitHub Check: CodeQL-Build
🔇 Additional comments (4)
src/components/Common/SearchByMultipleFields.tsx (3)
39-51
: LGTM! Interface update is well-defined.The
autoFocus
prop is correctly added as an optional boolean to theSearchByMultipleFieldsProps
interface.
191-199
: LGTM! PhoneInput enhancement is properly implemented.The
autoFocus
prop is correctly passed to thePhoneInput
component.
224-228
: LGTM! Focus management is properly handled.The
useEffect
hook correctly manages focus based on theautoFocus
prop changes.src/pages/PublicAppointments/PatientRegistration.tsx (1)
181-183
: LGTM! Cache invalidation is properly implemented.The cache invalidation ensures that the patients list is refreshed after creating a new patient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass inputRef to the component instead. autoFocus behaviour is manually controlled based on other states and side effects.
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit