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

Remove duplicates from the new Group and Workspace Invite page #7986

Merged
merged 3 commits into from
Mar 3, 2022

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Mar 2, 2022

Details

Fixed Issues

$ #5768

Tests

  1. Tested search functionality of NewGroupPage and workspace Invite page.
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I made sure to pull main before submitting my PR for review
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I clearly indicated the environment tests should be run in (Staging vs Production)
  • I wrote testing steps that cover success & fail scenarios (if applicable)
  • I ran the tests & they passed on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified there are no console errors related to changes in this PR
  • I followed proper code patterns (see Reviewing the code)
    • I added comments when the code was not self explanatory
    • I put all copy / text shown in the product in all src/languages/* files (if applicable)
    • I followed proper naming convention for platform-specific files (if applicable)
    • [ x I followed style guidelines (in Styling.md) for all style edits I made
  • I followed the guidelines as stated in the Review Guidelines

PR Reviewer Checklist

  • I verified the Author pulled main before submitting the PR
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I verified tests pass on all platforms & I tested again on all platforms
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines

QA Steps

  1. Open the New Group page.

  2. Select a few (two) users.

  3. Search for some text that results in those two users.

  4. Observe that when the search matches with any of the selected contacts No Result found message is not shown.

  5. Observe that when the search does not match with any of the selected contacts and there are no search results, the No Result found message is shown.

  6. Repeat the step on Workspace Member invite page.

  7. Run the above tests on each platform on staging.

  • Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web | Desktop

image
image

Mobile Web

image

iOS

image

Android

image

@parasharrajat parasharrajat marked this pull request as ready for review March 2, 2022 20:11
@parasharrajat parasharrajat requested a review from a team as a code owner March 2, 2022 20:11
@botify botify requested a review from thienlnam March 2, 2022 20:11
@MelvinBot MelvinBot removed the request for review from a team March 2, 2022 20:11
Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

One small comment, everything else looks good

@@ -108,17 +108,21 @@ class NewChatPage extends Component {
}
}

const filterText = _.reduce(this.state.selectedOptions, (str, {login}) => `${str} ${login}`, '');
Copy link
Contributor

Choose a reason for hiding this comment

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

This just takes all the filtered users and puts their name in a big string right? How come we do this over just putting them in an array and doing .includes?

Copy link
Member Author

Choose a reason for hiding this comment

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

This O(n). That would be O(n*n)

Copy link
Contributor

@thienlnam thienlnam Mar 2, 2022

Choose a reason for hiding this comment

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

How come? I wasn't able to find details about runtime complexity about string.includes() but I assume string.includes() in the worst case still searches the entire string that includes all the names

I found this SO on array.includes() which says it uses linear search and so the worst scenario for finding something is O(n).

So if that is the case the runtime wouldn't be different

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I will do this. It's no biggy. It can never hurt the app performance in any way.

Copy link
Member Author

Choose a reason for hiding this comment

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

but this is the breakout:
=> 111 O(n)
=> 112 O(n)

= O(n).

New changes.

_.filter(this.state.recentReports, ({login}) => !this.state.selectionOptions.find({slogin} => login === slogin));

There are two nested loops thus O(n*n).

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you still think change is needed? Let me know.

Copy link
Contributor

@thienlnam thienlnam Mar 3, 2022

Choose a reason for hiding this comment

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

Thanks for exploring this with me. I think they're both O(n*n) since _.reduce is also O(n) along with the string.includes O(n).

Though my biggest concern about it was that using a space delimiter is that it might lead to some edge cases with spaces in logins versus something more explicit like an array. But after thinking about it some more this might not be that big of a deal since the logins are emails/numbers

Copy link
Contributor

Choose a reason for hiding this comment

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

That being said, thanks again for looking into this but I think what you have here will be okay for our use case

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Overlooked it. Thanks for understanding. I will update the screenshot in few mintues.

@thienlnam
Copy link
Contributor

To push this forward, I just need the IOS screenshot and for the iOS tests to pass

@parasharrajat
Copy link
Member Author

@thienlnam Updated.

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@thienlnam thienlnam merged commit 692f92d into Expensify:main Mar 3, 2022
@OSBotify
Copy link
Contributor

OSBotify commented Mar 3, 2022

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @thienlnam in version: 1.1.42-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.42-6 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@abdulrahuman5196
Copy link
Contributor

The formation of string with delimiter caused an regression here - #21783

@parasharrajat
Copy link
Member Author

That's how the search was designed.

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.

None yet

4 participants