Skip to content

Fix add similar issue for iOS - #1152

Open
jordanstreiff wants to merge 1 commit into
falling-fruit:mainfrom
jordanstreiff:fix/add-similar
Open

Fix add similar issue for iOS#1152
jordanstreiff wants to merge 1 commit into
falling-fruit:mainfrom
jordanstreiff:fix/add-similar

Conversation

@jordanstreiff

Copy link
Copy Markdown

Was able to reproduce the bug on my iPhone and simulator.

When user submits the location state was getting wiped because the effect was being rerun, which forces a refetch. If the data hasn't already been populated the blank state becomes the new state. So it's a race condition that could potentially effect more than iOS.

Fix tested / works in simulator.

Closes #1143

Co-authored-by: Cursor <cursoragent@cursor.com>
@wbazant
wbazant self-requested a review July 25, 2026 08:10

@wbazant wbazant left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! Looks plausible, I think I also found a web repro - pull down the drawer and immediately press 'Add similar'. I'll build locally and check later when i have computer time. Happy to merge just after removing the explanatory comments but to maybe make this even better:

  • Does changing the ConnectNewLocation effect array by itself fix the race condition on iOS?
  • for the case when location ID changed to nothing (someone closed the drawer) and the toast is going away, maybe disable the button instead?

}
}, [dispatch, locationId, hasInitialView, isDesktop]) //eslint-disable-line
/*
* Mount-only: after a successful submit, locationId changes from 'new' to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment helped me understand how the change worked, thanks! I'm trying to keep the codebase relatively comment free. Can we take it out before merging? Maybe see if the doc in connectRoutes.js needs revising.

* The location captured when the success toast was created. Restore it
* in case something (e.g. the mobile drawer closing through /map)
* cleared the slice before the user tapped 'Add similar'.
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you check if changing the effect array in ConnectNewLocation is enough? This might not be necessary.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add similar broken on iOS

2 participants