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 payment 2023-10-13] [$500] Web - Pronouns value not displayed on login #27675

Closed
1 of 6 tasks
kbecciv opened this issue Sep 18, 2023 · 68 comments
Closed
1 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 Sep 18, 2023

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. Open the app
  2. Open settings->profile->pronouns
  3. Copy the URL
  4. Logout and paste the URL
  5. Login and observe that currently selected pronouns value is not displayed

Expected Result:

App should display pronouns value if present on login

Actual Result:

App does not display pronouns value if present on login on login with pronouns page

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.71.4
Reproducible in staging?: y
Reproducible in production?: y
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

No.pronouns.value.on.login.mp4
Recording.4559.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694889012343609

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014246fda785f9f058
  • Upwork Job ID: 1703768490032054272
  • Last Price Increase: 2023-09-25
  • Automatic offers:
    • dukenv0307 | Contributor | 26916802
@dukenv0307
Copy link
Contributor

Proposal

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

Pronouns value not displayed on login

What is the root cause of that problem?

We only set searchValue for the first render.

const [searchValue, setSearchValue] = useState(() => {

When we open the page via deep link on login, currentUserPersonalDetails is empty until the openApp API is complete. So the searchValue is empty.

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

We should subscribe isLoadingReportData to know when the openApp is complete.

Then we can create a useEffect to set searchValue state if the API is complete

useEffect(() => {
    if (isLoadingReportData && _.isEmpty(currentPronouns)) {
        return;
    }
    const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
        .find((_value) => _value === currentPronounsKey)
        .value();

    setSearchValue(currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '');
}, [currentPronouns, isLoadingReportData])

OPTIONAL: To make the best UI, we can display the loading page before the API is complete or hide the text input until the API is complete

What alternative solutions did you explore? (Optional)

NA

Result

Screencast.from.18-09-2023.17.46.10.webm

@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 18, 2023
@melvin-bot melvin-bot bot changed the title Web - Pronouns value not displayed on login [$500] Web - Pronouns value not displayed on login Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

Job added to Upwork: https://www.upwork.com/jobs/~014246fda785f9f058

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

melvin-bot bot commented Sep 18, 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

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@c3024
Copy link
Contributor

c3024 commented Sep 18, 2023

Proposal

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

Pronouns list is not shown initially when accessed from deep link and then logging in

What is the root cause of that problem?

We are setting the initial searchValue here

const [searchValue, setSearchValue] = useState(() => {
const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
.find((_value) => _value === currentPronounsKey)
.value();
return currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '';
});

When we access this page from deep link, initially currentPronounsKey is empty because currentUserPersonalDetails has not been loaded yet.

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

We should show a loading indicator when the page is loading and the pronouns field in currentUserPersonalDetails does not exist by adding this.

    if (!_.has(currentUserPersonalDetails, 'pronouns')) {
        return <FullScreenLoadingIndicator />;
    }

What alternative solutions did you explore? (Optional)

@saranshbalyan-1234
Copy link
Contributor

Proposal

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

Pronouns list is not shown initially when accessed from deep link and then logging in

What is the root cause of that problem?

The initial state does not contains the pronouns.

const [searchValue, setSearchValue] = useState(() => {
const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
.find((_value) => _value === currentPronounsKey)
.value();
return currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '';
});

When we access this page from deep link, initially currentPronounsKey is empty because currentUserPersonalDetails has not been loaded yet.

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

What we can do is we can use the below code to get the latest values from the currentUserPersonalDetails object.

    useMemo(() => {
        setSearchValue(() => {
            const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
                .find((_value) => _value === currentPronounsKey)
                .value();

            return currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '';
        });
    }, [currentPronounsKey]);

Also the callback that is passed in the setSearchValue, should be a different fucntion to reduce code redundancy

What alternative solutions did you explore? (Optional)

N/A

@CortneyOfstad
Copy link
Contributor

@joekaufmanexpensify there is a known issue with two assigners for BZ being applied (more info here), so going to remove my assignment as the second one for this issue 👍

@CortneyOfstad CortneyOfstad removed their assignment Sep 18, 2023
@joekaufmanexpensify
Copy link
Contributor

Sounds good!

@joekaufmanexpensify
Copy link
Contributor

i can reproduce this. Checking internally about something before saying definitively we should change this.

@joekaufmanexpensify
Copy link
Contributor

I chatted with @puneetlath to make sure we should fix this, since this form was designed with a lot intentionality, and confirmed that this is a bug. Next step is for @thesahindia to review proposals!

@joekaufmanexpensify
Copy link
Contributor

Pending review of proposals

@suneox
Copy link
Contributor

suneox commented Sep 21, 2023

Proposal

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

Web - Pronouns value not displayed on login

What is the root cause of that problem?

User info is loaded when the first time login via /api?command=OpenApp and the currentPronouns will get empty on the first time so the search value also empty

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

At withCurrentUserPersonalDetails.js we should get loading status with key ONYXKEYS.IS_LOADING_APP

    return withOnyx({
+       isLoading: {
+           key: ONYXKEYS.IS_LOADING_APP,
+       },
        personalDetails: {
            key: ONYXKEYS.PERSONAL_DETAILS_LIST,
        },
        session: {
            key: ONYXKEYS.SESSION,
        },
    })(withCurrentUserPersonalDetails);

also config propTypes and defaultProp for isLoading
Before render PronounsPage.js we will check isLoading status and return Loading component

    ...
+   if(props.isLoading) {
+       return <FullScreenLoadingIndicator />
+   }

    return (
      ...
    )

We should add a loading state to prevent users can editing before the data loaded while a slow network

update code from

const [searchValue, setSearchValue] = useState(() => {
const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
.find((_value) => _value === currentPronounsKey)
.value();
return currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '';
});

to

    const currentPronounsText = useMemo(() => {
        const currentPronounsText = _.chain(CONST.PRONOUNS_LIST)
            .find((_value) => _value === currentPronounsKey)
            .value();

        return currentPronounsText ? translate(`pronouns.${currentPronounsText}`) : '';
    }, [currentPronounsKey]);

    const [searchValue, setSearchValue] = useState(currentPronounsText);

    useEffect(() => {
        if (!isLoading && currentPronounsText) {
            setSearchValue(currentPronounsText);
        }
    }, [isLoading, currentPronounsText]);

A lot of pages use withCurrentUserPersonalDetails so we should add isLoading status into withCurrentUserPersonalDetails.js to be aware of using it for the next feature or fix issues the same with this

What alternative solutions did you explore? (Optional)

Create withCurrentUserPersonalDetailsAndLoadingState.js the same withCurrentUserPersonalDetails and same isLoading config from the primary solution
before render withCurrentUserPersonalDetailsAndLoadingState.js return Loading component

    function WithCurrentUserPersonalDetails(props) {
        const accountID = props.session.accountID;
        const accountPersonalDetails = props.personalDetails[accountID];
        const currentUserPersonalDetails = useMemo(() => ({...accountPersonalDetails, accountID}), [accountPersonalDetails, accountID]);
+       if (props.isLoading) {
+           return <FullScreenLoadingIndicator />;
+       }
        return (
            <WrappedComponent
                ...
            />
        );
    }

@joekaufmanexpensify
Copy link
Contributor

@thesahindia could you take a look at these proposals when you have a sec? TY!

@suneox
Copy link
Contributor

suneox commented Sep 22, 2023

I have updated my proposal and explain for each change

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@joekaufmanexpensify
Copy link
Contributor

Pending review of proposals

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@thesahindia
Copy link
Member

@dukenv0307's proposal looks good to me!

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@joekaufmanexpensify
Copy link
Contributor

Got it. I will review the timing before we issue payment. We still need @allroundexperts to complete the BZ checklist here before we can issue payment.

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@joekaufmanexpensify
Copy link
Contributor

Bumped in Slack

@allroundexperts
Copy link
Contributor

Checklist

  1. There isn't any particular PR to blame here. I think we just forgot to implement this edge case.
  2. N/A
  3. https://expensify.slack.com/archives/C049HHMV9SM/p1697574239538219
  4. A regression test would be good.

Regression test

  1. Login and make sure that the user has set up pronouns in the profile page.
  2. Copy the pronouns page url and logout.
  3. In a new tab, open the copied url and login.
  4. Verify that the pronouns that were set up in step 1 show up successfully.

Do we 👍 or 👎 ?

@joekaufmanexpensify
Copy link
Contributor

TY! IMO, we can punt the regression test here, as it doesn't seem realistic to me that many/any users will be frequently trying to deeplink login specifically to the pronouns page. This feels like a significant edge case to me, so no need to include it in every regression run.

@joekaufmanexpensify
Copy link
Contributor

Going to sort through the questions about contributor bounty, and whether the speed bonus applies here tomorrow. Once those are resolved, we'll be all set to issue payment!

@joekaufmanexpensify
Copy link
Contributor

Okay, chatted about the speed bonus internally, and we will offer that here, since both @allroundexperts and @dukenv0307 prioritized this one with urgency.

@joekaufmanexpensify
Copy link
Contributor

We are still discussing this a bit, and will issue payment as soon as that is resolved!

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 checking in on this. After further discussions, it sounds like the PR you ultimately implemented used some aspects of the other contributor's proposal.

No worries about this! But we're discussing splitting the $500 bounty with them, and want to make sure you don't have any significant concerns with that? TY!

@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@amyevans, @allroundexperts, @joekaufmanexpensify, @dukenv0307 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 could you please review this and let us know your thoughts? TY!

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@joekaufmanexpensify
Copy link
Contributor

Okay, while we wait for the contributor payments to be sorted out (via Upwork), we can handle @allroundexperts payment now. They will get $750 ($500 for C+ review + $250 speed bonus), paid via NewDot

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 24, 2023

@joekaufmanexpensify I agree with this .

@JmillsExpensify
Copy link

$750 payment approved for @allroundexperts based on summary above.

@joekaufmanexpensify
Copy link
Contributor

Great, thanks for confirming. That means we still need to issue the following payments:

  • @dukenv0307 - $375 ($250 for half of PR bounty, and $125 for 50% speed bonus for bounty paid). Paid vua Upwork.
  • @suneox - $250 for providing elements used in the solution. No speed bonus here since they did not contribute to the timed work to get this merged. Paid via upwork.
  • @dhanashree-sawant - $50 for reporting the bug. Paid via Upwork.

@joekaufmanexpensify
Copy link
Contributor

@suneox offer sent for $250!

@joekaufmanexpensify
Copy link
Contributor

@dhanashree-sawant offer sent for $50!

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 25, 2023

@joekaufmanexpensify I think the bonus should be $250 and we only split $500 between me and @suneox. Correct me if I missed something.

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 the urgency bonus is 50% of the bounty earned by the contributor who raised the PR, rather than a static bonus. Since you raised the PR, and are earning a $250 bounty for this issue, your 50% bonus for the PR is $125. A $250 bonus on your $250 bounty would be a 100% bonus.

@suneox isn't earning a bonus since they were not involved in the collaborative process of raising the PR quickly.

LMK if you have any other questions!

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 $375 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@suneox $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@dhanashree-sawant $50 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed

@joekaufmanexpensify
Copy link
Contributor

Bug is fixed, BZ checklist complete, and all payment issued. Closing as this is all set. Thanks everyone!

@dukenv0307
Copy link
Contributor

@dukenv0307 the urgency bonus is 50% of the bounty earned by the contributor who raised the PR, rather than a static bonus. Since you raised the PR, and are earning a $250 bounty for this issue, your 50% bonus for the PR is $125. A $250 bonus on your $250 bounty would be a 100% bonus.

@joekaufmanexpensify my take is that as we're splitting original bounty, we also share responsibility of getting a PR up and merged and will jointly be eligible for the $250 bonus if within 3 days. But 1 of us does not participate in the PR, only I handle the PR from start to end and strive to get it merged asap, I bear the whole responsibility (which by right should be split similar to the reward).

So it makes sense that I'll be eligible for the full bonus of the "PR responsibility" which is $250. I have seen that in other issues like this one. Could you kindly give this a second look, thanks!

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 I definitely understand where you're coming from. However, the previous guidance on the urgency bonus is fairly clear. It is a 50% bonus applied to the bounty earned to incentivize the individual writing the PR to get it done quickly. It scaled down with the various compensation changes we've made to the contributor program as well.

I think we handled the urgency bonus in that other issue incorrectly, so I don't think we'd issue a 100% urgency bonus here based on that.

We appreciate your understanding. Let me know if you have any other questions!

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