FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include "SchedulerPriority.h"
#include <functional>
#include <string>
namespace facebook::jsi {
class Runtime;
}
namespace facebook::react {
using CallFunc = std::function<void(jsi::Runtime &)>;
/**
* An interface for a generic native-to-JS call invoker. See BridgeJSCallInvoker
* for an implementation.
*/
class CallInvoker {
public:
virtual void invokeAsync(CallFunc &&func) noexcept = 0;
virtual void invokeAsync(SchedulerPriority /*priority*/, CallFunc &&func) noexcept
{
// When call with priority is not implemented, fall back to a regular async
// execution
invokeAsync(std::move(func));
}
virtual void invokeSync(CallFunc &&func) = 0;
// Backward compatibility only, prefer the CallFunc methods instead
virtual void invokeAsync(std::function<void()> &&func) noexcept
{
invokeAsync([func = std::move(func)](jsi::Runtime &) { func(); });
}
virtual void invokeSync(std::function<void()> &&func)
{
invokeSync([func = std::move(func)](jsi::Runtime &) { func(); });
}
virtual ~CallInvoker() = default;
};
using NativeMethodCallFunc = std::function<void()>;
class NativeMethodCallInvoker {
public:
virtual void invokeAsync(const std::string &methodName, NativeMethodCallFunc &&func) noexcept = 0;
virtual void invokeSync(const std::string &methodName, NativeMethodCallFunc &&func) = 0;
virtual ~NativeMethodCallInvoker() = default;
};
} // namespace facebook::react

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace facebook::react {
enum class SchedulerPriority : int {
ImmediatePriority = 1,
UserBlockingPriority = 2,
NormalPriority = 3,
LowPriority = 4,
IdlePriority = 5,
};
} // namespace facebook::react

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <ReactCommon/CallInvoker.h>
#include <jsi/jsi.h>
#include <list>
namespace facebook::react {
class TestCallInvoker : public CallInvoker {
public:
explicit TestCallInvoker(facebook::jsi::Runtime &runtime) : runtime_(runtime) {}
void invokeAsync(CallFunc &&func) noexcept override
{
queue_.push_back(std::move(func));
}
void invokeSync(CallFunc &&func) override
{
func(runtime_);
}
void flushQueue()
{
while (!queue_.empty()) {
queue_.front()(runtime_);
queue_.pop_front();
runtime_.drainMicrotasks(); // Run microtasks every cycle.
}
}
size_t queueSize()
{
return queue_.size();
}
private:
facebook::jsi::Runtime &runtime_;
std::list<CallFunc> queue_{};
};
} // namespace facebook::react