Skip to content

Commit 02490d0

Browse files
hoxyqfacebook-github-bot
authored andcommitted
No-op by default (#54335)
Summary: # 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
1 parent e3181b1 commit 02490d0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetConsole.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ jsi::Value consoleCreateTask(
555555
const jsi::Value* args,
556556
size_t count,
557557
RuntimeTargetDelegate& runtimeTargetDelegate,
558-
bool /* enabled */) {
558+
bool enabled) {
559559
if (count < 1 || !args[0].isString()) {
560560
throw JSError(runtime, "First argument must be a non-empty string");
561561
}
@@ -565,9 +565,12 @@ jsi::Value consoleCreateTask(
565565
}
566566

567567
jsi::Object task{runtime};
568-
auto taskContext = std::make_shared<ConsoleTaskContext>(
569-
runtime, runtimeTargetDelegate, name);
570-
taskContext->schedule();
568+
std::shared_ptr<ConsoleTaskContext> taskContext = nullptr;
569+
if (enabled) {
570+
taskContext = std::make_shared<ConsoleTaskContext>(
571+
runtime, runtimeTargetDelegate, name);
572+
taskContext->schedule();
573+
}
571574

572575
task.setProperty(
573576
runtime,

0 commit comments

Comments
 (0)