Repository navigation
AlarmKit: surface errors, fix unresumed continuation, cancel fallback, Nitro 0.37 - #28
Merged
Merged
Conversation
…, Nitro 0.37 Found while debugging an app whose running countdown could not be stopped from the app: every AlarmKit error was either swallowed or lost. - requestAuthorization() left its continuation unresumed on error, so the JS promise never settled; it now rejects. - Alarm operations throw AlarmOperationError with the operation, alarm id, state and the underlying AlarmKit error. - cancel() falls back to stop(id:) + cancel(id:) when AlarmKit refuses the first cancel, unless stopping already removed the alarm. - An unknown Alarm.State maps to scheduled instead of fatalError. - AlarmKitModule.nitro.ts re-exports AlarmState from AlarmProxy.nitro.ts instead of declaring a second enum with a different member order. - nitrogen / react-native-nitro-modules 0.37.1 (AnyMap BigInt -> Int64), peer dependency react-native-nitro-modules >= 0.37.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 9fda584 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
1 task
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Found while debugging kingstinct/undistractable: a running countdown could not be stopped from the app, and every AlarmKit error on that path was either swallowed or lost.
requestAuthorization()could hang forever. ThewithCheckedThrowingContinuationwrapper only resumed on success; a thrown error left the continuation unresumed and the JS promise never settled. Both it andscheduleAlarmnow usePromise.asyncdirectly and reject.cancel(),stop(),pause(),resume()andcountdown()throwAlarmOperationErrorwith the operation, alarm id, state and the underlying AlarmKit error, so the JS side sees e.g.AlarmKit cancel failed for alarm … in state countdown: …instead of a bare error.cancel()fallback. When AlarmKit refuses the firstcancel(id:), the alarm is stopped and cancelled again, unless stopping already removed it.fatalErroron unknownAlarm.State. A state added by a newer iOS maps toscheduled.AlarmStateenum.AlarmKitModule.nitro.tsdeclared a secondAlarmStatewith a different member order (alerting = 1, countdown = 2) thanAlarmProxy.nitro.ts(countdown = 1, alerting = 3); it now re-exports the proxy's enum.nitrogenandreact-native-nitro-modules0.37.1,AnyMapBigInt→Int64, peer dependencyreact-native-nitro-modules >= 0.37.0. Bindings regenerated withbun run specs.The same native changes ship as a
bun patchin the app until this is released.Test plan
bun run typecheck,bun run lint,bun run specsin this repo🤖 Generated with Claude Code