Replace InteractionManager #4

Closed
opened 2026-08-25 17:41:19 +00:00 by uwayss · 3 comments
Owner
 WARN  InteractionManager has been deprecated and will be removed in a future release. Please refactor long tasks into smaller ones, and  use 'requestIdleCallback' instead.
``` WARN InteractionManager has been deprecated and will be removed in a future release. Please refactor long tasks into smaller ones, and use 'requestIdleCallback' instead. ```
uwayss self-assigned this 2026-08-25 17:41:19 +00:00
Author
Owner

hey @claude can you fix this and open a pr pls?

hey @claude can you fix this and open a pr pls?
Author
Owner

hey @claude can you fix this and open a pr pls?

hey @claude can you fix this and open a pr pls?
Collaborator

Done — PR #5 is open from branch claude/issue-4-replace-interactionmanager.

What I found

InteractionManager had exactly one call site: src/screens/StatsScreen.tsx:62, where runAfterInteractions deferred the per-interval stats aggregation (prayer log filtering + percentage rollups) so it wouldn't run on the interaction path.

The change

Swapped it for the global requestIdleCallback / cancelIdleCallback — the replacement RN's own deprecation notice points at. I verified in node_modules/react-native/Libraries/Core/setUpTimers.js that RN polyfills both globals in both the bridgeless path (NativeIdleCallbacksCxx) and the legacy JSTimers path, so there's no new dependency and no platform gap.

One behavioural note worth flagging: runAfterInteractions always eventually fires, but idle time is not guaranteed to arrive on a busy screen. A bare requestIdleCallback could leave the aggregation — and therefore the loading spinner — stalled indefinitely. I passed { timeout: 500 } to close that gap; both RN implementations honour the timeout option.

The diff reads larger than it is: the only substantive edits are the import line, the two API calls, and the timeout. Everything else is Prettier re-indenting the callback body, which is now nested one level deeper as an argument rather than a bare trailing closure.

Verification

npm run checks:lint, npm run checks:tsc, and npm run checks:format all pass (I installed deps first — node_modules wasn't present in the checkout). tsc resolving requestIdleCallback cleanly under noImplicitAny confirms the globals are typed via the DOM lib that expo/tsconfig.base pulls in.

I did not run the app, so the "no more warning in the console" part is verified by the code change and the RN source rather than observed at runtime.

Done — [PR #5](https://code.uwayss.com/uwayss/muhsin/pulls/5) is open from branch `claude/issue-4-replace-interactionmanager`. ## What I found `InteractionManager` had exactly one call site: `src/screens/StatsScreen.tsx:62`, where `runAfterInteractions` deferred the per-interval stats aggregation (prayer log filtering + percentage rollups) so it wouldn't run on the interaction path. ## The change Swapped it for the global `requestIdleCallback` / `cancelIdleCallback` — the replacement RN's own deprecation notice points at. I verified in `node_modules/react-native/Libraries/Core/setUpTimers.js` that RN polyfills both globals in *both* the bridgeless path (`NativeIdleCallbacksCxx`) and the legacy `JSTimers` path, so there's no new dependency and no platform gap. One behavioural note worth flagging: `runAfterInteractions` always eventually fires, but idle time is not guaranteed to arrive on a busy screen. A bare `requestIdleCallback` could leave the aggregation — and therefore the loading spinner — stalled indefinitely. I passed `{ timeout: 500 }` to close that gap; both RN implementations honour the `timeout` option. The diff reads larger than it is: the only substantive edits are the import line, the two API calls, and the timeout. Everything else is Prettier re-indenting the callback body, which is now nested one level deeper as an argument rather than a bare trailing closure. ## Verification `npm run checks:lint`, `npm run checks:tsc`, and `npm run checks:format` all pass (I installed deps first — `node_modules` wasn't present in the checkout). `tsc` resolving `requestIdleCallback` cleanly under `noImplicitAny` confirms the globals are typed via the DOM lib that `expo/tsconfig.base` pulls in. I did not run the app, so the "no more warning in the console" part is verified by the code change and the RN source rather than observed at runtime.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#4
No description provided.