Skip to content

Commit d6e7079

Browse files
hoxyqmeta-codesync[bot]
authored andcommitted
No-op by default (#54335)
Summary: Pull Request resolved: #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
1 parent 21c211d commit d6e7079

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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)