Replace InteractionManager #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
hey @claude can you fix this and open a pr pls?
hey @claude can you fix this and open a pr pls?
Done — PR #5 is open from branch
claude/issue-4-replace-interactionmanager.What I found
InteractionManagerhad exactly one call site:src/screens/StatsScreen.tsx:62, whererunAfterInteractionsdeferred 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 innode_modules/react-native/Libraries/Core/setUpTimers.jsthat RN polyfills both globals in both the bridgeless path (NativeIdleCallbacksCxx) and the legacyJSTimerspath, so there's no new dependency and no platform gap.One behavioural note worth flagging:
runAfterInteractionsalways eventually fires, but idle time is not guaranteed to arrive on a busy screen. A barerequestIdleCallbackcould leave the aggregation — and therefore the loading spinner — stalled indefinitely. I passed{ timeout: 500 }to close that gap; both RN implementations honour thetimeoutoption.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, andnpm run checks:formatall pass (I installed deps first —node_moduleswasn't present in the checkout).tscresolvingrequestIdleCallbackcleanly undernoImplicitAnyconfirms the globals are typed via the DOM lib thatexpo/tsconfig.basepulls 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.