Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/attachRendererFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
break;
case HostText:
nodeType = 'Text';
publicInstance = fiber.stateNode;
text = fiber.memoizedProps;
break;
case Fragment:
Expand Down Expand Up @@ -456,6 +457,14 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
treeBaseDuration = fiber.treeBaseDuration;
}

if (publicInstance === null) {
// publicInstance is used for $r.
// If we have nothing useful to expose, at least give props and state.
// This is an escape hatch to avoid a situation where there is useful
// data in the tree but DevTools don't offer any way to get it through console.
publicInstance = { props, state, type };
}

// $FlowFixMe
return {
nodeType,
Expand Down