Repository navigation
fix(mobile): give React Native's AbortSignal throwIfAborted - #775
Merged
Merged
Conversation
The shared API client calls signal.throwIfAborted() after reading a response. React Native's AbortSignal has no such method, so every directions, reroute and transit refresh request from the installed app failed with "undefined is not a function".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Requests from the installed app through the shared API client fail with
TypeError: undefined is not a function. Since #585 the client callssignal.throwIfAborted()after reading a response, and React Native'sAbortSignalhas no such method. On Android this breaks every directions, native reroute and transit refresh request the shell makes itself (GroundRerouteService,TransitRefreshService); requests made by the website inside the WebView are unaffected.The app now installs
AbortSignal.prototype.throwIfAbortedat startup, before any other module runs, the same way it already installscrypto.getRandomValues. It throws the signal'sreason, or anAbortErrorwhen there is none, and leaves an existing implementation alone.Verification
fetchDirectionsclient, and the device log showed the TypeError at thecontroller.signal.throwIfAborted()line ofpackages/core/src/api/client.ts. With this polyfill the same request returned routes.tsc --noEmit, Biome.Release and upgrade impact
No package release: app-only change in
apps/mobile. It takes effect with the next app build.