Skip to content
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

Mpdx 8163 fix phone numbers input lag #1082

Merged
merged 7 commits into from
Sep 23, 2024

Conversation

wjames111
Copy link
Contributor

@wjames111 wjames111 commented Sep 19, 2024

Description

Tickets

  • Tools - Fix Phone Numbers - input lag - Jira Ticket 8163
  • Tools - Fix Phone Numbers - consoler errors - Jira Ticket 8164
  • Tools - Fix Phone Numbers - Bulk Confirm Modal - Jira Ticket 8165
  • Tools - Fix Phone Numbers - Snackbar Warning - Jira Ticket MPDX-8173
  • Tools - Fix Phone Numbers - poorly sized contact - Jira Ticket MPDX-8172

Description of Each Ticket

  • Formik managing all state can cause significant lag with large numbers of entries. Ideally, implementing infinite scroll would improve performance by loading only a small portion of entries at a time. However, this doesn’t appear to be the case.
  • Console error p tag cannot be a descendent of a p tag
  • There is no modal for confirming bulk fixes to phone numbers, whereas all other tools have this feature.
  • Snackbar warning when Confirm All button does nothing
  • Deleting all numbers reveals poorly sized contact.

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels Sep 19, 2024
@wjames111 wjames111 self-assigned this Sep 19, 2024
@wjames111 wjames111 requested a review from canac September 19, 2024 20:03
Copy link
Contributor

Copy link
Contributor

github-actions bot commented Sep 19, 2024

Bundle sizes [mpdx-react]

Compared against a536cc4

Route Size (gzipped) Diff
/accountLists/[accountListId]/tools/fix/phoneNumbers/[[...contactId]] 147.76 KB -101.75 KB

Copy link
Contributor

@canac canac left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Do you think you could fix the circle around the add button being an oval?

Screenshot 2024-09-19 at 4 08 48 PM

src/components/Tool/FixPhoneNumbers/Contact.tsx Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/Contact.tsx Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/Contact.tsx Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/Contact.tsx Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/Contact.tsx Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/helper.ts Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/helper.ts Outdated Show resolved Hide resolved
src/components/Tool/FixPhoneNumbers/helper.test.ts Outdated Show resolved Hide resolved
@wjames111 wjames111 requested a review from canac September 20, 2024 18:58
@wjames111 wjames111 force-pushed the MPDX-8163-fix-phone-numbers-input-lag branch from 266833d to cbee27d Compare September 20, 2024 19:01
@canac
Copy link
Contributor

canac commented Sep 20, 2024

@wjames111 Everything is marked resolved, but did you make any changes? I looked at a few of the items, and it looks like it did when I reviewed last time.

@wjames111
Copy link
Contributor Author

@canac hmmm that's odd, I just rebased maybe I messed something up.

@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview and removed On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels Sep 20, 2024
@@ -124,53 +115,66 @@ const FixPhoneNumbers: React.FC<Props> = ({
}: Props) => {
const { classes } = useStyles();
const { enqueueSnackbar } = useSnackbar();
const { appName } = useGetAppSettings();
const appName = process.env.APP_NAME ?? 'MPDX';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think useGetAppSettings is a better way of doing this. Was there a reason you switched?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed Fix Mailing Addresses was doing it this way, and I was trying to model off that tool as closely as possible as they're pretty similar.

src/components/Tool/FixPhoneNumbers/FixPhoneNumbers.tsx Outdated Show resolved Hide resolved
Comment on lines 205 to 207
fireEvent.change(getByTestId('source-select'), {
target: { value: 'MPDX' },
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could use userEvent.click also. You probably have to click on source-select and then click on getByRole('option', { name: "Item name" }).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So only issue with this is I'm getting, "unable to click element as it has or inherits pointer-events set to 'none'." Not sure the best way to get around this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the selectbox disabled?

Copy link
Contributor Author

@wjames111 wjames111 Sep 20, 2024

Choose a reason for hiding this comment

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

It doesn't appear to be

        <Select
                      className={classes.select}
                      inputProps={{ 'data-testid': 'source-select' }}
                      value={defaultSource}
                      onChange={(event: SelectChangeEvent) =>
                        handleSourceChange(event)
                      }
                      size="small"
                    >
                      {sourceOptions.map((source) => (
                        <MenuItem
                          key={source}
                          value={source}
                          data-testid="select-option"
                        >
                          {source}
                        </MenuItem>
                      ))}
                    </Select>

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, the input has aria-hidden="true" on it. I think what you want to do is put the select and the "Default Primary Source" label in a <FormControl> like here. That will be better for accessibility too because "Default Primary Source" will be associated with the select box. Then in the test you can find it with getByRole('combobox', { name: 'Default Primary Source '}).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice this works, It does change the style of it a good amount. I think it works better though and like you said, it's more accessable. My only concern is it not looking like the other tools. Do you think I should wrap the bulk select with FormControl on the others as well?

src/components/Tool/FixPhoneNumbers/helper.ts Outdated Show resolved Hide resolved
@wjames111 wjames111 requested a review from canac September 20, 2024 21:10
@wjames111 wjames111 requested a review from canac September 23, 2024 14:39
</Select>
<Box className={classes.defaultBox}>
<FormControl size="small">
<InputLabel shrink id="source-select" size="small">
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making this a FormControl! Looks like two elements have the id source-select and ids are supposed to be unique. You can probably remove them both unless you know of a reason to keep them. Also, I don't think that inputProps={{ 'data-testid': 'source-select' }} is needed anymore since we are finding the select input by its role.

userEvent.click(primarySource);
userEvent.click(getByRole('option', { name: 'MPDX' }));

expect(getByTestId('source-select')).toHaveValue('MPDX');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
expect(getByTestId('source-select')).toHaveValue('MPDX');
expect(primarySource).toHaveValue('MPDX');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Getting undefined here for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly, I was also thinking that you could remove this line of the test. A more useful test could be to check that the confirm button as the text "Confirm 52 as MPDX". And I just realized that if "MPDX" is the initial value of that combobox, it would be better to select a different option so that the value actually changes. I feel like I'm stringing you along in asking for changes to the tests, but I promise that's not my intention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hahah no you're fine. I'd like to make it as good as I can. So your feedback is needed.

Copy link
Contributor

@canac canac left a comment

Choose a reason for hiding this comment

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

I'm going to approve since my last two suggests are very minor. Great work with all of these improvements!

@wjames111 wjames111 force-pushed the MPDX-8163-fix-phone-numbers-input-lag branch from 98bc3cd to e2ced21 Compare September 23, 2024 17:01
@wjames111 wjames111 merged commit 615138b into main Sep 23, 2024
17 of 18 checks passed
@wjames111 wjames111 deleted the MPDX-8163-fix-phone-numbers-input-lag branch September 23, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants