Skip to content

[HOLD for payment 2024-01-16] [$500] Web - IOUs - location text does not change on selecting 'Use current location' #33016

Closed

Description

@izarutskaya

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


Version Number: v1.4.12-0
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
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation: @

Action Performed:

  1. Open the app
  2. Click on green plus and click request money -> distance
  3. Open start/finish
  4. Search any location and select the result
  5. Again open same field used in step 3
  6. Ensure that location action is disabled
  7. Remove current location text and select 'Use current location', it will trigger error
  8. Now enable location access and again select 'Use current location'
  9. Observe now that on main distance page, it still displays older location instead of 'Your location', open the same field as step 3 and observe that inside it displays 'Your location' properly

Expected Result:

App should display 'Your location' on selecting 'Use current location' in any waypoint

Actual Result:

App displays older location value instead of 'Your location' on selecting 'Use current location' in any waypoint if location access is enabled after error is triggered

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6312011_1702489356189.windows_chrome_-_your_location_not_displayed.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0168cfb95cbebc1039
  • Upwork Job ID: 1735036732238655488
  • Last Price Increase: 2023-12-27
  • Automatic offers:
    • ZhenjaHorbach | Contributor | 28071864
Issue OwnerCurrent Issue Owner: @stephanieelliott

Activity

  1. added
    External
    Daily
    Bug
    on Dec 13, 2023
  2. melvin-bot commented on Dec 13, 2023

    @melvin-bot

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

  3. changed the title [-]Web - IOUs - location text does not change on selecting 'Use current location'[/-] [+][$500] Web - IOUs - location text does not change on selecting 'Use current location'[/+] on Dec 13, 2023
  4. melvin-bot commented on Dec 13, 2023

    @melvin-bot
  5. melvin-bot commented on Dec 13, 2023

    @melvin-bot

    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
  6. added
    Help Wanted
    on Dec 13, 2023
  7. melvin-bot commented on Dec 13, 2023

    @melvin-bot

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

  8. ZhenjaHorbach commented on Dec 13, 2023

    @ZhenjaHorbach
    Contributor

    Proposal

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

    Web - IOUs - location text does not change on selecting 'Use current location'

    What is the root cause of that problem?

    We don't pass name param

    const location = {
    lat: successData.coords.latitude,
    lng: successData.coords.longitude,
    address: CONST.YOUR_LOCATION_TEXT,
    };

    As a result we pass undefined value inside Transaction.saveWaypoint

    As a result, the previous value is used

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

    In order to fix this, we can use the implementation from WaypointEditor

    we can set name: values.name || null,

    Plus here(optional)

    Like here

    name: values.name || null,

    What alternative solutions did you explore? (Optional)

    As alternative, we can pass name param (CONST.YOUR_LOCATION_TEXT or null ) or set name === null by default in Transaction.saveWaypoint (But since we use Transaction.saveWaypoint in two places. It is not very required )

                    const location = {
                        lat: successData.coords.latitude,
                        lng: successData.coords.longitude,
                        address: CONST.YOUR_LOCATION_TEXT,
    	            name: CONST.YOUR_LOCATION_TEXT, //As alternative null
                    };
    

    const location = {
    lat: successData.coords.latitude,
    lng: successData.coords.longitude,
    address: CONST.YOUR_LOCATION_TEXT,
    };

  9. DylanDylann commented on Dec 14, 2023

    @DylanDylann
    Contributor

    Proposal

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

    App displays older location value instead of 'Your location' on selecting 'Use current location' in any waypoint if location access is enabled after error is triggered

    What is the root cause of that problem?

    we don't pass the name field to the location here.

    const location = {
    lat: successData.coords.latitude,
    lng: successData.coords.longitude,
    address: CONST.YOUR_LOCATION_TEXT,
    };

    So that the name field will be undefined. Currently, when updating waypoints we are using MERGE method, and the old name value will be retained. It caused this bug

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

    In here

    Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {

    We can combine the old transaction and the new change, then use SET method instead of MERGE method as we did here
    #30290 (comment)
    Note that: MERGE method caused many similar bugs so we usually use SET method when updating waypoints like here
    Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, newTransaction);

    What alternative solutions did you explore? (Optional)

    If we still use MERGE method, I think we should have a general solution instead of fixing case by case (It is so easy to miss similar bugs elsewhere)

    Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {

    In here we can check if the name field is undefined we will set it to null or address field

  10. kaushiktd commented on Dec 14, 2023

    @kaushiktd
    Contributor

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

    Web - IOUs - location text does not change on selecting 'Use current location'

    What is the root cause of that problem?

    When we select use current location name field value show as undefined in selectWaypoint
    https://github.com/Expensify/App/blob/main/src/pages/iou/request/step/IOURequestStepWaypoint.js#L169

    name: [values.name],

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

    https://github.com/Expensify/App/blob/main/src/pages/iou/request/step/IOURequestStepWaypoint.js#L169

    Implement more robust handling of undefined values for name in the Transaction.saveWaypoint method by providing a default value explicitly:

    name: [values.name](http://values.name/) !== undefined ? [values.name](http://values.name/) : CONST.YOUR_LOCATION_TEXT,

    This code explicitly checks for undefined values and assigns CONST.YOUR_LOCATION_TEXT as a fallback to ensure consistency.

    Video:-

    https://drive.google.com/file/d/1gl9HvRNJUpybpImBi6ey1z4u-ktt-tNd/view?usp=sharing

  11. allstarsmen commented on Dec 14, 2023

    @allstarsmen

    Proposal

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

    Web - IOUs - location text does not change on selecting 'Use current location'

    What is the root cause of that problem?

    We use 'Onyx.merge()' to update the 'waypoint' object, but the 'Onyx.merge()' will ignore the property with 'undefined' value, so in this case, all properties in 'waypoint' will be updated except the 'name' property.

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

    In here

    function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoint | null, isDraft = false) {

    We should set the name of the current location to an empty string.

    Screenshot 2023-12-14 at 16 20 07

    What alternative solutions did you explore? (Optional)

    No

    Result

    Before.mov
    After.mov
  12. 36 remaining items

  13. added
    Awaiting Payment
    on Jan 10, 2024
  14. changed the title [-][$500] Web - IOUs - location text does not change on selecting 'Use current location'[/-] [+][HOLD for payment 2024-01-16] [$500] Web - IOUs - location text does not change on selecting 'Use current location'[/+] on Jan 10, 2024
  15. added
    Daily
    and removed
    Weekly
    on Jan 17, 2024
  16. mananjadhav commented on Jan 19, 2024

    @mananjadhav
    Collaborator

    I couldn't pinpoint the specific PR that must've caused this. I also don't think we need a regression test for this.

    @stephanieelliott This is ready for payout, can you please post a payment summary?

  17. stephanieelliott commented on Jan 19, 2024

    @stephanieelliott
    Contributor

    Summarizing payment on this issue:

    Upwork job is here: https://www.upwork.com/jobs/~1737876297360310272"

  18. moved this from Release 3: Migration for All to Done in [#whatsnext] Wave 05 - Deprecate Freeon Jan 19, 2024
  19. kaushiktd commented on Jan 20, 2024

    @kaushiktd
    Contributor

    @stephanieelliott When should I expect payment?

  20. mananjadhav commented on Jan 20, 2024

    @mananjadhav
    Collaborator

    @stephanieelliott When should I expect payment?

    @kaushiktd Payment regarding?

  21. kaushiktd commented on Jan 21, 2024

    @kaushiktd
    Contributor
  22. JmillsExpensify commented on Jan 22, 2024

    @JmillsExpensify
    Contributor

    $500 payment approved to @mananjadhav based on this comment.

  23. kaushiktd commented on Jan 23, 2024

    @kaushiktd
    Contributor

    @JmillsExpensify any update on my payment?

  24. stephanieelliott commented on Jan 23, 2024

    @stephanieelliott
    Contributor

    @kaushiktd can you clarify what specifically you are expecting payment for? No payment is due on this issue as your proposal was not selected and you were not hired for this job. For more context into how and when Expensify issues payment please see contributing.md

  25. kaushiktd commented on Jan 23, 2024

    @kaushiktd
    Contributor

    It seems I made a mistake. Sorry! I misunderstood this issue for the one I got selected. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringExternalReviewing

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions