BN-84 | Refactor. Remove Inline Notification for duplicate diagnosis #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA → BN-84
Description
This PR enhances the error feedback that is shown to the user when the user tries to add a Diagnosis which is already selected. Instead of showing an Inline error on click of a duplicate item, now the search results are filtered and already selected items are marked as disabled with an indicative text.
Key Features
This PR mainly focusses on refactoring the error handling for duplicate diagnosis selection. Inline Alert Notification is removed. The error handling is now done by filtering the search results and marking already added diagnoses as disabled. Also to give a visual indication to the user, an text
(Already Selected)is appended to the concept name on the result dropdown.Implementation Details
State Management
The additional state in DIagnosisForm for diagnosisErrors has been removed.
Performance & Optimization
Memoization is used on the computation of filteredResults to avoid recomputation when the dependencies does not change.
Internationalisation
A new key is added for (Already Selected) text and is translation in Spanish as well.
Accessibility
In order to enhance accessibility and support use of screen readers, the Already Selected label has been introduced.
Testing & Type Definitions
Unit tests are refactored on DiagnosisForm.test.tsx
Screenshots
Note: Please ensure sensitive information is not included in screenshots.
Important
Checklist
Reviewer(s)
@bahnew/developers
Kindly review the proposed changes when convenient. Your feedback is appreciated.