-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
872a714
to
9b30fc5
Compare
@@ -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 |
There was a problem hiding this comment.
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
a682d64
to
783cae4
Compare
scrollToTop() | ||
.onChange(of: nearbyVM.nearbyState.stopIds) { [oldValue = nearbyVM.nearbyState.stopIds] newNearbyStops in | ||
|
||
if Set(oldValue ?? []) != Set(newNearbyStops ?? []) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 🙏
Didn't fix the issue |
Co-authored-by: EmmaSimon <emmamaysimon@gmail.com>
…onChange for testability
…stance filter to prevent jittery nearby refetching
2d357bb
to
f950655
Compare
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. |
There was a problem hiding this 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?
There was a problem hiding this 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.
b333ffd
to
bd97c1e
Compare
@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>
bd97c1e
to
a702dc7
Compare
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
android
withContext(Dispatchers.Default)
where possible (ideally in shared code)Testing
What testing have you done?