mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
No-op by default (#54335)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54335 # Changelog: [Internal] Actually gate the task scheduling logic, so that the implementation is a no-op by default, if we are not tracing in the background or have Runtime CDP domain enabled. The drawback is that we might loose stack traces for some component renders, if the corresponding JSX declaration was called before we've enabled the `console.createTask()`. Reviewed By: huntie Differential Revision: D85849862 fbshipit-source-id: 2c3e8119ca0ab5677b2c00e83b9a616d5e924db1
This commit is contained in:
1 parent
21c211d6ff
commit
d6e70791d8
1 file changed
+7
-4
@@ -555,7 +555,7 @@ jsi::Value consoleCreateTask(
|
||||
const jsi::Value* args,
|
||||
size_t count,
|
||||
RuntimeTargetDelegate& runtimeTargetDelegate,
|
||||
bool /* enabled */) {
|
||||
bool enabled) {
|
||||
if (count < 1 || !args[0].isString()) {
|
||||
throw JSError(runtime, "First argument must be a non-empty string");
|
||||
}
|
||||
@@ -565,9 +565,12 @@ jsi::Value consoleCreateTask(
|
||||
}
|
||||
|
||||
jsi::Object task{runtime};
|
||||
auto taskContext = std::make_shared<ConsoleTaskContext>(
|
||||
runtime, runtimeTargetDelegate, name);
|
||||
taskContext->schedule();
|
||||
std::shared_ptr<ConsoleTaskContext> taskContext = nullptr;
|
||||
if (enabled) {
|
||||
taskContext = std::make_shared<ConsoleTaskContext>(
|
||||
runtime, runtimeTargetDelegate, name);
|
||||
taskContext->schedule();
|
||||
}
|
||||
|
||||
task.setProperty(
|
||||
runtime,
|
||||
|
||||
Reference in new issue
Block a user