Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Conversation

Stephen-Tsen
Copy link
Contributor

@Stephen-Tsen Stephen-Tsen commented Nov 22, 2023

Jira Ticket Number: CTW-1620

This PR fixes a bug in patient search when there are multiple patients with the same name. Previously the ComboBoxOption's value was the label, which comprised the patient's full name. When an option was selected, the ComboBoxField would use the label to look up the first occurrence in the results, so if there are 2 or more patients with the same full name, it would always return the first patient.

Now the ComboBoxOption's value is the entire option so we can just return the option's value, which is the ComboxboxFieldOption object, to the onCustomSelectChange callback.

How did you test it?

Manually tested in the demo app.
Manually tested with relative dependancies in standalone.

How will you know that this is working after deployment?

Manually test in all environments

- Refactor `ComboBoxOption` to use the full option value instead of just the label
- Default `defaultValue` and `defaultSearchTerm` for `ComboBoxField`
- Remove unused imports
Copy link

changeset-bot bot commented Nov 22, 2023

🦋 Changeset detected

Latest commit: c161b56

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@zus-health/ctw-component-library Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

mrosata
mrosata previously approved these changes Nov 22, 2023
Copy link
Contributor

@mrosata mrosata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@WesleyKapow
Copy link
Contributor

@Stephen-Tsen this may want to go into CTW repo instead!

const option = e as ComboxboxFieldOption;
setSearchTerm(option.label);
setInputValue(option.value);
onCustomSelectChange?.(option);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call the callback with the entire option object for backwards compatibility.

The plan is to apply this same fix to the next app/monorepo, and in there I will change this line to call the callback with just the option's value.

@Stephen-Tsen
Copy link
Contributor Author

@Stephen-Tsen this may want to go into CTW repo instead!

I'll apply a slightly modified version of this to the monorepo

mrosata
mrosata previously approved these changes Nov 22, 2023
@Stephen-Tsen Stephen-Tsen merged commit 72ef732 into main Nov 22, 2023
4 checks passed
@Stephen-Tsen Stephen-Tsen deleted the CTW-1620-patient-search-does-not-navigate-to-correct-patient-if-multiple-patients-in-the-list-have-the-same-name branch November 22, 2023 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants