App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Request Money - Text in the compose box changes from "Say hello" to "Write something" & vice versa

Open kbecciv opened this issue 2 years ago • 28 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to URL https://staging.new.expensify.com/
  2. Login with any account
  3. Click on FAB button/Request money or Split bill
  4. Сomplete the action
  5. Pay attention to the text in the input field

Also,

  1. Click on FAB button/New chat
  2. Select new user with no previous chat
  3. Pay attention to compose box
  4. Placeholder text changes

Expected Result:

The text in the input field shouldn't changes

Actual Result:

The text in the input field changes from "Say hello" to "Write something." from "Say hello" to "Write something."

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.2.10.0

Reproducible in staging?: Yes

Reproducible in production?: Yes

Email or phone of affected tester (no customers): any

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

Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/93399543/193309858-87395bdb-d279-43ef-a283-ed04c9e244f0.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

kbecciv avatar Sep 30 '22 15:09 kbecciv

Triggered auto assignment to @MonilBhavsar (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

melvin-bot[bot] avatar Sep 30 '22 15:09 melvin-bot[bot]

Not a critical bug, looking it later

MonilBhavsar avatar Oct 03 '22 07:10 MonilBhavsar

I think this is more general issue and also occurs when -

  1. Click on FAB button/New chat
  2. Select new user with no previous chat
  3. Pay attention to compose box
  4. Placeholder text changes

MonilBhavsar avatar Oct 07 '22 11:10 MonilBhavsar

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

melvin-bot[bot] avatar Oct 07 '22 11:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 07 '22 11:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 07 '22 11:10 melvin-bot[bot]

Proposal

The issue here is that while the chat is loading, our fallback value is "Say hello" Now we have two options: Either change the fallback text to Write something Or completely delete the fallback value so it is an empty string and after loading is finished display the proper value

That would be done here.

https://github.com/Expensify/App/blob/6551eb9d07f54c222bd6cb7411b7613f3ccd03b4/src/pages/home/report/ReportActionCompose.js#L244-L258

Like this:

// Waiting until ONYX variables are loaded before displaying the input place holder
        if (_.isEmpty(this.props.reportActions)) {
            return '';
        }

Uros787 avatar Oct 07 '22 12:10 Uros787

Proposal

Root Cause

  • This happens because in our code base we have added validation to check if isEmptyChat which basically returns the length of this.props.reportActions and if chat is empty we are returning 1 as even empty chat reportActions object will be containing one record of creating

  • Text in the input field changes from "Say hello" to "Write something." because when we are updating a reportActions at a particular moment reportActions length would be 0 empty so we need to add one more validation to check if reportActions is not 0

        if (this.isEmptyChat() && _.size(this.props.reportActions) !== 0) {
            return this.props.translate('reportActionCompose.sayHello');
        }

https://github.com/Expensify/App/blob/44bf1ffc491cd1e99258ddbe07823a99b80e9aad/src/pages/home/report/ReportActionCompose.js#L253-L255

Reason why we should not use _.isEmpty(this.props.reportActions)

  • If we add this condition to check the placeholder it will work on the very first time when ONYX is not loaded but on next refresh ONYX is already loaded so this will fail
// Waiting until ONYX variables are loaded before displaying the input place holder
        if (_.isEmpty(this.props.reportActions)) {
            return '';
        }

Result

https://user-images.githubusercontent.com/47522946/194557162-b6d27e83-4fd2-4f2c-91d8-e5cc6f5276fc.mov

Without Fix

https://user-images.githubusercontent.com/47522946/194686408-c7115327-cef5-4b7e-895c-57a5f30ed640.mov

dhairyasenjaliya avatar Oct 07 '22 12:10 dhairyasenjaliya

Went through the proposals and @dhairyasenjaliya's proposal here looks good to me.

@MonilBhavsar All yours.

🎀 👀 🎀  C+ reviewed

mananjadhav avatar Oct 10 '22 19:10 mananjadhav

@dhairyasenjaliya could you please check if this issue use case is also fixed- https://github.com/Expensify/App/issues/11471#issuecomment-1271485274

MonilBhavsar avatar Oct 11 '22 13:10 MonilBhavsar

@dhairyasenjaliya could you please check if this issue use case is also fixed- #11471 (comment)

I did check this condition now, so basically, here we are adding a conditional check when reportAction is not empty at that time we display Say Hello, but if we want to add this condition then we should probably add a condition whereby if reportAction is blank at that time we need to return placeholder as empty since only after data is loaded we can identify the type of placeholder (E.g Say Hello/Write something)

cc @MonilBhavsar @mananjadhav

dhairyasenjaliya avatar Oct 11 '22 13:10 dhairyasenjaliya

@MonilBhavsar @dhairyasenjaliya I am not able to reproduce this in a general scenario. Here's the video from staging. Am I missing something on the reproduction steps?

https://user-images.githubusercontent.com/3069065/196001475-20c8b290-6f7e-49fd-9665-8df7203ac3d4.mp4

mananjadhav avatar Oct 15 '22 18:10 mananjadhav

@mananjadhav try to request money from non-selected user or you are just referring to a new chat user?

dhairyasenjaliya avatar Oct 15 '22 18:10 dhairyasenjaliya

yeah Request a money I am aware but not with New Chat as mentioned in the GH body. Hence, clarifying.

mananjadhav avatar Oct 15 '22 18:10 mananjadhav

ah got it @mananjadhav can you select the user that never has any chat, I mean make sure the selected user has not even initialized any messages (previously did message and delete that messages)

dhairyasenjaliya avatar Oct 15 '22 18:10 dhairyasenjaliya

(if you check the video), I am trying a very random email that don't exist in the system

mananjadhav avatar Oct 15 '22 18:10 mananjadhav

Hmm, I'm also not able to reproduce now. @kbecciv could you please confirm if this issue is still reproducible. Thank you!

MonilBhavsar avatar Oct 18 '22 11:10 MonilBhavsar

@MonilBhavsar Checking with team, will update you shortly

kbecciv avatar Oct 18 '22 14:10 kbecciv

@MonilBhavsar Issue is still reproduced with build 1.2.17.4

https://user-images.githubusercontent.com/93399543/196500038-c8ff1eac-6052-48e9-9849-50921e336efd.mp4

kbecciv avatar Oct 18 '22 17:10 kbecciv

https://www.upwork.com/ab/applicants/1582488161449332736/job-details

slafortune avatar Oct 18 '22 21:10 slafortune

Thanks! Yes, reproducible with request money flow. Waiting for proposals...

MonilBhavsar avatar Oct 19 '22 04:10 MonilBhavsar

@MonilBhavsar https://github.com/Expensify/App/issues/11471#issuecomment-1271544517 this proposal is for request money flow can you confirm @mananjadhav

dhairyasenjaliya avatar Oct 19 '22 04:10 dhairyasenjaliya

@MonilBhavsar Just for request flow, I shortlisted a proposal if you check the comment here

mananjadhav avatar Oct 19 '22 04:10 mananjadhav

Thanks, had a look. When we request from a completely new account, the transition still happens, but I think that is because of a new reportAction is added at that moment.

MonilBhavsar avatar Oct 19 '22 05:10 MonilBhavsar

@MonilBhavsar Any updates on this one?

mananjadhav avatar Oct 24 '22 20:10 mananjadhav

Quick bump on this @MonilBhavsar

mananjadhav avatar Oct 27 '22 17:10 mananjadhav

Proposal looks good to me. let's implement it

MonilBhavsar avatar Oct 31 '22 08:10 MonilBhavsar

📣 @dhairyasenjaliya You have been assigned to this job by @MonilBhavsar! 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 📖

melvin-bot[bot] avatar Oct 31 '22 08:10 melvin-bot[bot]

great, will create PR probably today :)

dhairyasenjaliya avatar Nov 01 '22 03:11 dhairyasenjaliya

@dhairyasenjaliya This PR is in draft for a few days. Can we please have it closed soon? Can you please send us an update on this one.

mananjadhav avatar Nov 05 '22 18:11 mananjadhav