8000 fix(iosApp.NearbyTransitView): Don't reset nearby when stops reordered by KaylaBrady · Pull Request #921 · mbta/mobile_app · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(iosApp.NearbyTransitView): Don't reset nearby when stops reordered #921

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

Merged
merged 6 commits into from
May 8, 2025

Conversation

KaylaBrady
Copy link
Collaborator
@KaylaBrady KaylaBrady commented Apr 28, 2025

Summary

What is this PR for?
No ticket, addresses issue raised in slack where there have been some reports of nearby transit auto-scrolling to the top of the sheet when there are stops ~equidistant nearby.

iOS

  • If you added any user-facing strings on iOS, are they included in Localizable.xcstrings?
    • Add temporary machine translations, marked "Needs Review"

android

  • All user-facing strings added to strings resource in alphabetical order
  • Expensive calculations are run in withContext(Dispatchers.Default) where possible (ideally in shared code)

Testing

What testing have you done?

  • added a unit test
  • Tested locally with artificial location jitter at a coordinate known to be affected by this issue
  • Tested in dev orange

@KaylaBrady KaylaBrady added the deploy to ios dev-orange Automatically deploy this PR to iOS dev-orange label Apr 28, 2025
@KaylaBrady KaylaBrady force-pushed the kb-nearby-reset-hotfix branch from 872a714 to 9b30fc5 Compare April 28, 2025 16:18
@@ -70,7 +77,7 @@ struct NearbyTransitView: View {
.onChange(of: location) { newLocation in
getNearby(location: newLocation, globalData: globalData)
}
.onChange(of: nearbyVM.nearbyState.stopIds) { nearbyStops in
.onChange(of: setOfNearbyStopIds) { nearbyStops in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it may be nicer / more testable to test the set equality of the previous & current value for nearbyStops, will try that out too

@KaylaBrady KaylaBrady force-pushed the kb-nearby-reset-hotfix branch from a682d64 to 783cae4 Compare April 28, 2025 16:30
scrollToTop()
.onChange(of: nearbyVM.nearbyState.stopIds) { [oldValue = nearbyVM.nearbyState.stopIds] newNearbyStops in

if Set(oldValue ?? []) != Set(newNearbyStops ?? []) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a little icky, but it makes it easier to write a test.

@KaylaBrady KaylaBrady marked this pull request as ready for review April 28, 2025 16:33
@KaylaBrady KaylaBrady requested a review from a team as a code owner April 28, 2025 16:33
@KaylaBrady KaylaBrady requested a review from EmmaSimon April 28, 2025 16:33
Copy link
Contributor
@EmmaSimon EmmaSimon left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning up my mess 🙏

@KaylaBrady
Copy link
Collaborator Author

Didn't fix the issue

@KaylaBrady KaylaBrady closed this Apr 28, 2025
@KaylaBrady KaylaBrady deleted the kb-nearby-reset-hotfix branch April 28, 2025 20:34
@KaylaBrady KaylaBrady reopened this May 7, 2025
@KaylaBrady KaylaBrady removed the deploy to ios dev-orange Automatically deploy this PR to iOS dev-orange label May 8, 2025
@KaylaBrady KaylaBrady force-pushed the kb-nearby-reset-hotfix branch from 2d357bb to f950655 Compare May 8, 2025 14:53
@KaylaBrady
Copy link
Collaborator Author

This does in fact fix the scrolling issue issue when the group by direction flag is on.

Updated to apply the same distance filter in android as ios for consistency.

@KaylaBrady KaylaBrady requested a review from EmmaSimon May 8, 2025 14:55
Copy link
Contributor
@EmmaSimon EmmaSimon left a comment

Choose a reason for hiding this comment

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

Can we also try removing the routeCardData = nil in NearbyViewModel.getNearbyStops to see if that prevents the reloading/jumping to the top when location does change?

Copy link
Contributor
@EmmaSimon EmmaSimon left a comment

Choose a reason for hiding this comment

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

If that does resolve the issue, it might be fine to bump the location update distance from 10 down to 5. We can deploy it to staging like this and see what Paul thinks though.

@KaylaBrady KaylaBrady force-pushed the kb-nearby-reset-hotfix branch from b333ffd to bd97c1e Compare May 8, 2025 17:49
@KaylaBrady
Copy link
Collaborator Author

@EmmaSimon I tried it out walking around the block and it definitely made the difference, great call! I still think 10m is reasonable based on the amount of wobble I see at my desk locally (and is at least better than the 100m now on android), but agree we can revisit this value once it is in staging!

Co-authored-by: EmmaSimon  <emmamaysimon@gmail.com>
@KaylaBrady KaylaBrady force-pushed the kb-nearby-reset-hotfix branch from bd97c1e to a702dc7 Compare May 8, 2025 17:56
@KaylaBrady KaylaBrady added this pull request to the merge queue May 8, 2025
Merged via the queue into main with commit dab0c27 May 8, 2025
10 checks passed
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.

2 participants
0