Skip to content

Commit

Permalink
Revert D51394187: delete ShadowNodeFamily::instanceHandle_
Browse files Browse the repository at this point in the history
Differential Revision:
D51394187

Original commit changeset: 3add711a3954

Original Phabricator Diff: D51394187

fbshipit-source-id: 881fb82c949fef05f001fec57f62911a3a5dc482
  • Loading branch information
rubennorte authored and facebook-github-bot committed Nov 17, 2023
1 parent d9fa64e commit ba43dd2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ const SharedEventEmitter& ShadowNode::getEventEmitter() const {
}

jsi::Value ShadowNode::getInstanceHandle(jsi::Runtime& runtime) const {
return family_->eventEmitter_->getEventTarget()->getInstanceHandle(runtime);
auto instanceHandle = family_->instanceHandle_;
if (instanceHandle == nullptr) {
return jsi::Value::null();
}

return instanceHandle->getInstanceHandle(runtime);
}

Tag ShadowNode::getTag() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ShadowNodeFamily::ShadowNodeFamily(
: eventDispatcher_(std::move(eventDispatcher)),
tag_(fragment.tag),
surfaceId_(fragment.surfaceId),
instanceHandle_(fragment.instanceHandle),
eventEmitter_(std::move(eventEmitter)),
componentDescriptor_(componentDescriptor),
componentHandle_(componentDescriptor.getComponentHandle()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ class ShadowNodeFamily final {
*/
const SurfaceId surfaceId_;

/*
* Weak reference to the React instance handle
*/
InstanceHandle::Shared const instanceHandle_;

/*
* `EventEmitter` associated with all nodes of the family.
*/
Expand Down

0 comments on commit ba43dd2

Please sign in to comment.