Skip to content

Conversation

@mohan-13
Copy link
Member

JIRABN-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
    Unit tests are refactored on DiagnosisForm.test.tsx

Screenshots

Feature / State Screenshot
Before Refactor image
After Refactor image

Note: Please ensure sensitive information is not included in screenshots.



Important

Checklist

  • Code adheres to project linting and formatting standards.
  • New components added to Storybook.
  • Tests written and passing (unit + integration).
  • Labels and text support i18n.
  • Follows accessibility and responsive design guidelines.
  • PR reviewed by at least one other developer.

Reviewer(s)

@bahnew/developers
Kindly review the proposed changes when convenient. Your feedback is appreciated.


@mohan-13 mohan-13 requested a review from rahu1ramesh May 30, 2025 01:02
@mohan-13 mohan-13 merged commit ac113e2 into main May 30, 2025
2 checks passed
@mohan-13 mohan-13 deleted the BN-84-fix-duplicate-diagnoses branch June 12, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants