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

[HOLD for Santhosh] [$1000] mWeb - New room - Room names in LHN do not match the name when created #20510

Closed
2 of 6 tasks
kbecciv opened this issue Jun 9, 2023 · 40 comments
Closed
2 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jun 9, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in with a High traffic account that owns a existing Workspace
  3. Click on the green + button
  4. Click on the "New Room" option
  5. Set the name of the #Room to anything you'd like (following the correct format)
  6. Go to LHN

Expected Result:

The name of the room matches the name when created

Actual Result:

Room names in LHN do not match the name when created. Room name shows 0 at the end

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.26.1

Reproducible in staging?: yes

Reproducible in production?: yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6086477_Screen_Recording_20230609_090130_Chrome.mp4
Bug6086477_2023_06_09_13_46_Img_9746.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team / @Natnael-Guchima

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01172d30b33b712701
  • Upwork Job ID: 1667249070496825344
  • Last Price Increase: 2023-06-09
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@hungvu193
Copy link
Contributor

hungvu193 commented Jun 9, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

mWeb - New room - Room names in LHN do not match the name when created

What is the root cause of that problem?

Let take a look at this piece of code:

{this.props.displayNamesWithTooltips.length > 1 && this.state.isEllipsisActive && (
<View style={styles.displayNameTooltipEllipsis}>
<Tooltip text={this.props.fullTitle}>
{/* There is some Gap for real ellipsis so we are adding 4 `.` to cover */}
<Text>....</Text>
</Tooltip>
</View>

As we can see we will render the tooltip when this.props.displayNamesWithTooltips.length > 1 and this.state.isEllipsisActive is true.
isEllipsisActive: this.containerRef && this.containerRef.offsetWidth && this.containerRef.scrollWidth && this.containerRef.offsetWidth < this.containerRef.scrollWidth,

The problem is the this.containerRef.offsetWidth and this.containerRef.scrollWidth can be zero when we resize window.
Screen Shot 2023-06-09 at 22 52 15
Now this.state.isEllipsisActive can be 0:
Screen Shot 2023-06-09 at 22 19 43

And because of that the condition here will render 0 with this.props.displayNamesWithTooltips.length > 1.

{this.props.displayNamesWithTooltips.length > 1 && this.state.isEllipsisActive && (
<View style={styles.displayNameTooltipEllipsis}>
<Tooltip text={this.props.fullTitle}>
{/* There is some Gap for real ellipsis so we are adding 4 `.` to cover */}
<Text>....</Text>
</Tooltip>
</View>

What changes do you think we should make in order to solve the problem?

Make sure the this.state.isEllipsisActive is boolean value. We should cast it to Boolean.

 {this.props.displayNamesWithTooltips.length > 1 && Boolean(this.state.isEllipsisActive) && (
                    <View style={styles.displayNameTooltipEllipsis}>
                        <Tooltip text={this.props.fullTitle}>
                            {/* There is some Gap for real ellipsis so we are adding 4 `.` to cover */}
                            <Text>....</Text>
                        </Tooltip>
                    </View>
                )}

What alternative solutions did you explore? (Optional)

We can disable tooltip with mobile web

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Jun 9, 2023
@melvin-bot melvin-bot bot changed the title mWeb - New room - Room names in LHN do not match the name when created [$1000] mWeb - New room - Room names in LHN do not match the name when created Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01172d30b33b712701

@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

Triggered auto assignment to @Beamanator (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@jeet-dhandha
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

mWeb - New room - Room names has 0 at end.

What is the root cause of that problem?

  • As we are using this.state.isEllipsisActive to check if we need to render ellipsis or not.
  • But this.state.isEllipsisActive is not boolean value.
  • It is returning 0 as value when this.containerRef.scrollWidth / this.containerRef.offsetWidth is 0 and this.containerRef is an object.

What changes do you think we should make in order to solve the problem?

  • Solution 1: Make sure the this.state.isEllipsisActive is boolean value. We should cast it to Boolean. (Mentioned by @hungvu193).
  • Solution 2:
    • Create a function which check's and sets the this.state.isEllipsisActive state to false when scrollWidth is 0 || offsetWidth is 0. OR Set it to the return value of condition scrollWidth > offsetWidth.
class DisplayNames extends PureComponent {
    constructor(props) {
        ...rest code
        this.checkEllipsis = this.checkEllipsis.bind(this);
    }

    componentDidMount() {
      this.checkEllipsis() // Added function instead of direct setState call.
    }
    ...rest code

    /**
     * Function - Check if Ellipsis is active and Set the class variable.
     */
    checkEllipsis() {
      const {scrollWidth, offsetWidth} = this.containerRef || {};
      if ( !scrollWidth || !offsetWidth ) {
          this.setState({isEllipsisActive: false});
      }
      this.setState({isEllipsisActive: scrollWidth > offsetWidth});
    }
    ...rest code
}

What alternative solutions did you explore? (Optional)

  • N/A

@tienifr
Copy link
Contributor

tienifr commented Jun 10, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Room names in LHN do not match the name when created. Room name shows 0 at the end

What is the root cause of that problem?

The issue is the condition here is not robust

isEllipsisActive: this.containerRef && this.containerRef.offsetWidth && this.containerRef.scrollWidth && this.containerRef.offsetWidth < this.containerRef.scrollWidth,

When this.containerRef.scrollWidth or this.containerRef.offsetWidth is 0 (in case of mWeb), isEllipsisActive will be 0, not boolean as it should be, so it will show the additional 0 here
{this.props.displayNamesWithTooltips.length > 1 && this.state.isEllipsisActive && (

What changes do you think we should make in order to solve the problem?

We should never chain && with non-boolean values like this.containerRef.scrollWidth, this.containerRef.offsetWidth in order to get the boolean. We need to make the condition here more robust:

isEllipsisActive: !!this.containerRef && this.containerRef.offsetWidth > 0 && this.containerRef.scrollWidth > 0 && this.containerRef.offsetWidth < this.containerRef.scrollWidth,

(or can check this.containerRef !== null)

As we can see, all elements of the && chain are booleans, thus isEllipsisActive will always be boolean, not some arbitrary values like null, 0, ...

What alternative solutions did you explore? (Optional)

We can cast isEllipsisActive to boolean inside componentDidMount before setting the state, this way at least we're not setting random values like null, 0 to the state. Although I still prefer to fix it at the root as mentioned above.

@melvin-bot melvin-bot bot added the Overdue label Jun 12, 2023
@NicMendonca
Copy link
Contributor

@Santhosh-Sellavel bump on the proposals when you get the chance ^ thanks!

@melvin-bot melvin-bot bot removed the Overdue label Jun 12, 2023
@Santhosh-Sellavel
Copy link
Collaborator

@Beamanator
@hungvu193 Proposal looks good to me
C+ Reviewed
🎀 👀 🎀

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

📣 @hungvu193 You have been assigned to this job by @Beamanator!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@tienifr
Copy link
Contributor

tienifr commented Jun 13, 2023

@Santhosh-Sellavel can you give some feedback on other proposals and why the selected proposal is the best? Since there're different solutions to the issue.

Thanks!

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 13, 2023
@Santhosh-Sellavel
Copy link
Collaborator

@tienifr
Sorry simple and straightforward issue. The root cause is the same. We should get the boolean value correctly from the computation. The change is already proposed by @hungvu193. And it's working.

@jeet-dhandha Proposed the same approach, the other approach is a bit over-engineered.

@tienifr You are just changing the computation. I think that's a good option too.

But instead of changing conditions, just getting a Boolean value from the final computation is simple and working so went with it.

cc: @Beamanator

@tienifr
Copy link
Contributor

tienifr commented Jun 14, 2023

But instead of changing conditions, just getting a Boolean value from the final computation is simple and working so went with it.

@Santhosh-Sellavel It's working but:

  • The state saved for isEllipsisActive is 0 which is wrong since isEllipsisActive is supposed to be a boolean
  • It's easy to use isEllipsisActive in another place and forget to use Boolean, since it's supposed to be a boolean value, this can cause issue in the future
  • The problem is in how isEllipsisActive is computed, not how it's used, so I don't think converting to Boolean fixes the root cause, it's rather a workaround

cc @Beamanator

@Santhosh-Sellavel
Copy link
Collaborator

It's easy to use isEllipsisActive in another place and forget to use Boolean since it's supposed to be a boolean value, this can cause issues in the future

That's not the case now and fairly simple usage and more or less an edge case, I can't think of any scenario where might need that. In the future when it's needed the changes will be done accordingly. Where there stated need to be computed/change state also, instead of one-time initialization. At that point, we might go with a function that computes the state and return it once.

cc: @Beamanator

@NicMendonca NicMendonca removed their assignment Jun 23, 2023
@NicMendonca NicMendonca added the Bug Something is broken. Auto assigns a BugZero manager. label Jun 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 23, 2023

Triggered auto assignment to @michaelhaxhiu (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot

This comment was marked as duplicate.

@NicMendonca
Copy link
Contributor

@Natnael-Guchima @hungvu193 have been paid.

@Santhosh-Sellavel can you please apply to the job and complete the BZ check list?

I am going OOO until Wednesday so assigning a buddy to watch this while I am away. @michaelhaxhiu can you please pay @Santhosh-Sellavel once they apply? You can leave the BZ checklist for me until Wednesday

@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

@Beamanator, @michaelhaxhiu, @hungvu193, @NicMendonca, @Santhosh-Sellavel Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Beamanator
Copy link
Contributor

Bump @michaelhaxhiu - are you able to get to payment today? If not, I guess @NicMendonca will be back tomorrow to finish payment (assuming @Santhosh-Sellavel applied for the job)

@melvin-bot melvin-bot bot removed the Overdue label Jun 27, 2023
@NicMendonca
Copy link
Contributor

@Santhosh-Sellavel accept my offer please 😄

@NicMendonca NicMendonca changed the title [HOLD for payment 2023-06-23] [$1000] mWeb - New room - Room names in LHN do not match the name when created [HOLD for Santhosh] [$1000] mWeb - New room - Room names in LHN do not match the name when created Jun 29, 2023
@melvin-bot melvin-bot bot added the Overdue label Jun 30, 2023
@NicMendonca
Copy link
Contributor

@Santhosh-Sellavel I know we're holding on payment for this one, but friendly bump on the checklist: #20510 (comment)

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 30, 2023
@NicMendonca
Copy link
Contributor

@Santhosh-Sellavel bump ^

@melvin-bot melvin-bot bot removed the Overdue label Jul 4, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jul 4, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

We can skip the checklist here as it's a very minor thing, I don't think we need regression tests as well. As this should be covered by the normal test cases. If needed let's use this

@Beamanator Let me know if differ on any of the above thanks!

@Santhosh-Sellavel
Copy link
Collaborator

Regression Steps:

  1. Login with a High traffic account that owns an existing Workspace
  2. Click on the green + button
  3. Click on the "New Room" option
  4. Set the name of the #Room to anything you'd like (following the correct format)
  5. Go to LHN, and verify that the Room name in LHN matched the name when created

👍 or 👎

@NicMendonca
Copy link
Contributor

@Santhosh-Sellavel can you remind me next steps for Payment?

@Santhosh-Sellavel
Copy link
Collaborator

Ya sure!

@anmurali
Copy link

anmurali commented Jul 7, 2023

Paid on New Dot

@NicMendonca
Copy link
Contributor

Fab! We're all done set here then. Thanks everyone 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

10 participants