Regression in requestIdleCallback introduced by:
The timeout is never assigned, so it is never forwarded to runtimeScheduler.
Before the PR above, it was being assigned alongside expirationTime.
With the current code the task will keep running for up to 5 minutes (default value).
|
std::optional<HighResDuration> timeout; |
|
std::optional<HighResTimeStamp> expirationTime; |
|
|
|
if (options.has_value() && options.value().timeout.has_value()) { |
|
HighResDuration userTimeout = options.value().timeout.value(); |
|
if (userTimeout > HighResDuration::zero()) { |
|
expirationTime = runtimeScheduler->now() + userTimeout; |
|
} |
|
} |
|
if (timeout.has_value()) { |
|
task = runtimeScheduler->scheduleIdleTask( |
|
std::move(wrappedCallback), timeout.value()); |
|
} else { |
|
task = runtimeScheduler->scheduleIdleTask(std::move(wrappedCallback)); |
|
} |
Reproducer
#57571
The PR above also contains the fix for the issue.
Regression in
requestIdleCallbackintroduced by:The
timeoutis never assigned, so it is never forwarded toruntimeScheduler.Before the PR above, it was being assigned alongside
expirationTime.With the current code the task will keep running for up to
5 minutes(default value).react-native/packages/react-native/ReactCommon/react/nativemodule/idlecallbacks/NativeIdleCallbacks.cpp
Lines 84 to 92 in 7fa4907
react-native/packages/react-native/ReactCommon/react/nativemodule/idlecallbacks/NativeIdleCallbacks.cpp
Lines 122 to 127 in 7fa4907
Reproducer
#57571
The PR above also contains the fix for the issue.