refactor(stats): replace deprecated InteractionManager with requestIdleCallback #5

Merged
uwayss merged 1 commit from claude/issue-4-replace-interactionmanager into main 2026-08-25 20:12:10 +00:00
Collaborator

Fixes #4.

InteractionManager is deprecated in React Native 0.86 and logs the warning from the issue on every use. The only call site is src/screens/StatsScreen.tsx, where runAfterInteractions defers the per-interval stats aggregation off the interaction path.

Change: swapped it for the global requestIdleCallback / cancelIdleCallback that RN's deprecation notice points at. Both are polyfilled by RN in bridgeless and legacy modes, so no new dependency.

A { timeout: 500 } option is passed because idle time is not guaranteed to arrive on a busy screen — without it the aggregation (and therefore the loading spinner) could stall indefinitely. runAfterInteractions had no such failure mode, so the timeout keeps behaviour equivalent.

The diff looks larger than it is: everything else is re-indentation from Prettier, since the callback is now nested one level deeper as an argument.

npm run checks:lint, checks:tsc and checks:format all pass.

🤖 Generated with Claude Code

Fixes #4. `InteractionManager` is deprecated in React Native 0.86 and logs the warning from the issue on every use. The only call site is `src/screens/StatsScreen.tsx`, where `runAfterInteractions` defers the per-interval stats aggregation off the interaction path. **Change:** swapped it for the global `requestIdleCallback` / `cancelIdleCallback` that RN's deprecation notice points at. Both are polyfilled by RN in bridgeless and legacy modes, so no new dependency. A `{ timeout: 500 }` option is passed because idle time is not guaranteed to arrive on a busy screen — without it the aggregation (and therefore the loading spinner) could stall indefinitely. `runAfterInteractions` had no such failure mode, so the timeout keeps behaviour equivalent. The diff looks larger than it is: everything else is re-indentation from Prettier, since the callback is now nested one level deeper as an argument. `npm run checks:lint`, `checks:tsc` and `checks:format` all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(stats): replace deprecated InteractionManager with requestIdleCallback
All checks were successful
Checks / checks (pull_request) Successful in 18s
115668f218
InteractionManager is deprecated in React Native 0.86 and logs a warning on
every use. StatsScreen used runAfterInteractions to defer its per-interval
stats aggregation off the interaction path; requestIdleCallback covers the
same need and is the replacement RN points at.

A timeout of 500ms is passed so the work still runs (and the spinner still
clears) on a screen that never goes idle.

Closes #4

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
uwayss merged commit fc31cc67de into main 2026-08-25 20:12:10 +00:00
uwayss deleted branch claude/issue-4-replace-interactionmanager 2026-08-25 20:31:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
uwayss/muhsin!5
No description provided.