Repository navigation
fix(test-app): handle sign-in cancellation and duplicate taps - #4711
Conversation
Size Report
Startup median (7 runs, lower is better):
|
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
examples/test-app/src/screens/AuthSessionLabScreen.tsx:33 |
Cancellation still renders "error": the native module sets no error code |
Reviewed with this repository's own Sentinel configuration (7c1934fc035d).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 991325f. The verdict and the full list are in the summary comment.
| const canceled = | ||
| typeof error === 'object' && | ||
| error !== null && | ||
| 'code' in error && | ||
| error.code === 'ERR_AUTH_SESSION_CANCELED'; |
There was a problem hiding this comment.
🟡 Minor · Cancellation still renders "error": the native module sets no error code
User taps SIGN IN then dismisses the sheet: the Swift module rejects with Exception(name: "AuthSessionCanceled", description: ...) and never supplies a code:, so error.code === 'ERR_AUTH_SESSION_CANCELED' is false and the screen renders error. Expo populates code only from a code: parameter on Exception; a name-only Exception surfaces its name on error.name, not as an ERR_* code.
| const canceled = | |
| typeof error === 'object' && | |
| error !== null && | |
| 'code' in error && | |
| error.code === 'ERR_AUTH_SESSION_CANCELED'; | |
| const canceled = | |
| (typeof error === 'object' && | |
| error !== null && | |
| 'code' in error && | |
| error.code === 'ERR_AUTH_SESSION_CANCELED') || | |
| (error instanceof Error && error.name === 'AuthSessionCanceled'); |
Details
persona: senior-developer, javascript
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
There was a problem hiding this comment.
@apex-sentinel-staging pivot The pinned Expo version derives a code when Exception has a name and no explicit code. In expo-modules-core@58.0.3, Exception.code returns customCode ?? errorCodeFromString(name). I compiled Expo's unchanged Swift sources and passed the fixture's name-only exception through any Error and then any JavaScriptThrowable. It yielded ERR_AUTH_SESSION_CANCELED. The pinned expo-modules-jsi@58.0.2 async promise rejection calls JavaScriptError.from, which sets the JS Error's code from that witness. The screen's code check matches that path, so an error.name fallback would add a second contract without evidence. This verifies the pinned bridge source and the Swift code witness. Live dismissal is still unverified.
|
I reviewed 991325f and found no problems in the code, so the change looks ready. Not blocking, and you can take or leave these: the screen matches the hardcoded There are no conflicts. Smoke Tests (ios), iOS Release and a review check were still running when I posted, and none has failed. The diff only touches a fixture screen under |
Summary
Preserve cancellation and single presentation in the hosted sign-in fixture added in #4708. Expo sends
ERR_AUTH_SESSION_CANCELEDon the rejection'scode. A synchronous guard prevents a second tap from calling the native module while the first sheet is active, and clears when that attempt finishes. One fixture screen changes.Addresses both Apex findings on #4708 (cancellation, duplicate taps).
Validation
806f73c, it called the module twice and renderederrorfor the Expo cancellation. At991325f, it called once, renderedcanceled, accepted a new tap after cancellation, and distinguished a genuine error.991325f. The same patch on the original PR head passed formatting, the repository build, and simulator app repack. GitHub validates this commit.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.