A framework for building native applications using React
Capture idle callback before running it (#54984)
Summary: Fixes https://github.com/facebook/react-native/issues/54983 https://github.com/facebook/react-native/issues/54983 has more details, but in short, this code here: ```kotlin currentIdleCallbackRunnable?.cancel() currentIdleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) reactApplicationContext.runOnJSQueueThread(currentIdleCallbackRunnable) ``` If `currentIdleCallbackRunnable` change between line 2 and line 3 (which is known to happen), the wrong runnable would be sent to be run. The fix is to simply capture it in a local variable before passing it to be run ```kotlin currentIdleCallbackRunnable?.cancel() val idleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) currentIdleCallbackRunnable = idleCallbackRunnable reactApplicationContext.runOnJSQueueThread(idleCallbackRunnable) ``` ## Changelog: [ANDROID] [FIXED] - Capture idle callback before running it Pull Request resolved: https://github.com/facebook/react-native/pull/54984 Test Plan: Unfortunately this is a pretty speculative change. That said, since the change is so simple, the worst thing that can happen is nothing. I have also run it in production here with no known issues https://github.com/bluesky-social/social-app/pull/9436 Reviewed By: cortinico Differential Revision: D90120471 Pulled By: lunaleaps fbshipit-source-id: c853a976be999fa883a5835fd5e8ac75a8699681
S
Samuel Newman committed
90e48d6031de3188a71157fe22d80b138a8d7605
Parent: 749b8f6
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 1/5/2026, 7:46:16 PM