You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-10-10] [$500] Web - Country and State fields are empty if accessed via deep link #27814
Home address page opens but "Country" and "State" values are missing
Expected Result:
"Country" and "State/Province" values should be shown if saved by user
Actual Result:
"Country" and "State/Province" values are missing given that user's saved the values
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.70.7 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
changed the title [-]Web - Country and State fields are empty if accessed via deep link[/-][+][$500] Web - Country and State fields are empty if accessed via deep link[/+]on Sep 19, 2023
The address object is initially empty, which is causing the issue as we are not setting the state and country states once the address object is changed.
Please re-state the problem that we are trying to solve in this issue
Country and State fields are empty if accessed via deep link
What is the root cause of that problem?
The issue arises from the fact that the address.state and address.country values are being fetched after the initial state initialization. This delay in fetching the values is due to the presence of an isLoading variable. Consequently, when the initial state is set, it is based on an empty JSON object because the actual values have not yet been retrieved. This results in incorrect initialization with empty values, which should ideally reflect the user's address information.
What changes do you think we should make in order to solve the problem?
I recommend initializing all fields (such as state, country, firstStreet, and secondStreet) with empty values initially. Then, use the useEffect hook to update these fields only when the isLoadingPersonalDetails variable indicates that the data retrieval process has completed.
Because they currently aren't using setState. I would suggest changing to the setState, even tho we are not changing theirs states, and use in the useEffect to avoid future bugs similar to this, because street1 and street2 are using outdated values. But that part is optional, since it work fine without changing them, so that part is completely optional and up to the review to see if they agree with the modification or not. If we would not change we just change the state and country part of the implementation that I suggested.
This is a video working locally with the changes that I mention above.
@Christinadobrzyn can you please guide me on how the payouts work for reporters? From past issues, it seems like some reporters get 50 and some get 250 and 500
@saranshbalyan-1234 I think you'll see an offer now, I'll hire you for the $500 and include the $250 bonus (so the payment will be $750 but the breakdown on the offer will be different).
The PR that introduced the bug has been identified. Link to the PR: there isn't a PR that caused this bug, it was present in the initial implementation
The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N/A
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: I don't think an additional discussion is needed, this is a case that was missed during the initial implementation. We already have a reviewer checklist item precisely for these types of bugs: If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
Activity
melvin-bot commentedon Sep 19, 2023
Job added to Upwork: https://www.upwork.com/jobs/~010def5669f0fd1df5
[-]Web - Country and State fields are empty if accessed via deep link[/-][+][$500] Web - Country and State fields are empty if accessed via deep link[/+]melvin-bot commentedon Sep 19, 2023
Triggered auto assignment to @peterdbarkerUK (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 19, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Sep 19, 2023
Triggered auto assignment to @Christinadobrzyn (
External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.melvin-bot commentedon Sep 19, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)saranshbalyan-1234 commentedon Sep 19, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Country" and "State/Province" values are missing while using deeplink
What is the root cause of that problem?
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 70 in f6efb26
The address object is initially empty, which is causing the issue as we are not setting the state and country states once the address object is changed.
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 73 in f6efb26
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 65 in f6efb26
What changes do you think we should make in order to solve the problem?
Also we can move country state from
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 65 in f6efb26
to this
What alternative solutions did you explore? (Optional)
N/A
lcsvcn commentedon Sep 19, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue
Country and State fields are empty if accessed via deep link
What is the root cause of that problem?
The issue arises from the fact that the address.state and address.country values are being fetched after the initial state initialization. This delay in fetching the values is due to the presence of an isLoading variable. Consequently, when the initial state is set, it is based on an empty JSON object because the actual values have not yet been retrieved. This results in incorrect initialization with empty values, which should ideally reflect the user's address information.
What changes do you think we should make in order to solve the problem?
I recommend initializing all fields (such as state, country, firstStreet, and secondStreet) with empty values initially. Then, use the useEffect hook to update these fields only when the isLoadingPersonalDetails variable indicates that the data retrieval process has completed.
Please note that both of these lines in the code:
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 65 in f6efb26
App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 73 in f6efb26
Are unnecessary, as they set values when the address data is still loading.
This approach simplifies the code and ensures that we always work with the most up-to-date values.
At
src/pages/settings/Profile/PersonalDetails/AddressPage.js:We can keep the
street1,street2as it is in the line:App/src/pages/settings/Profile/PersonalDetails/AddressPage.js
Line 72 in f6efb26
Because they currently aren't using
setState. I would suggest changing to thesetState, even tho we are not changing theirs states, and use in theuseEffectto avoid future bugs similar to this, becausestreet1andstreet2are using outdated values. But that part is optional, since it work fine without changing them, so that part is completely optional and up to the review to see if they agree with the modification or not. If we would not change we just change the state and country part of the implementation that I suggested.This is a video working locally with the changes that I mention above.
Video
video.bug.mov
Here are my suggested changes for review
If my proposal is accepted, I can open a PR in a few hours to fix this. Thank you!
What alternative solutions did you explore? (Optional)
N/A
42 remaining items
saranshbalyan-1234 commentedon Oct 3, 2023
Thanks for explaining :)
Christinadobrzyn commentedon Oct 10, 2023
Payouts due after we get the checklist done:
Issue Reporter: $50 @ufumerfarooq (Paid in Upwork)
Contributor: $500 + $250 bonus @saranshbalyan-1234 (Paid in Upwork)
Contributor+: $500 + $250 bonus @eVoloshchak (paid outside Upwork
Eligible for 50% #urgency bonus? Y - based on #27814 (comment)
Upwork job is here.
@eVoloshchak can you complete the checklist for us?
umerfarooq492 commentedon Oct 10, 2023
@Christinadobrzyn can you please guide me on how the payouts work for reporters? From past issues, it seems like some reporters get 50 and some get 250 and 500
saranshbalyan-1234 commentedon Oct 10, 2023
applied @Christinadobrzyn please check
Christinadobrzyn commentedon Oct 10, 2023
@ufumerfarooq Happy to clarify. We recently changed our payments:
Christinadobrzyn commentedon Oct 10, 2023
@saranshbalyan-1234 I think you'll see an offer now, I'll hire you for the $500 and include the $250 bonus (so the payment will be $750 but the breakdown on the offer will be different).
Christinadobrzyn commentedon Oct 10, 2023
@eVoloshchak can you complete the #27814 (comment) for us? Thanks!
saranshbalyan-1234 commentedon Oct 10, 2023
@Christinadobrzyn thank you
eVoloshchak commentedon Oct 12, 2023
If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.eVoloshchak commentedon Oct 12, 2023
Regression Test Proposal
Do we agree 👍 or 👎
JmillsExpensify commentedon Oct 12, 2023
$750 payment approved for @eVoloshchak based on the BZ summary.
Christinadobrzyn commentedon Oct 12, 2023
regression test here - https://github.com/Expensify/Expensify/issues/325802
Payment is complete - based on - #27814 (comment)
Closing!