Skip to content

Conversation

sebmarkbage
Copy link
Collaborator

This adds precaching to ReactDOMFiber. I.e. adding a handle from the DOM node to the internal Fiber. This means that we need to expose an internal handle to the reconciler.

We use duck typing inside ReactDOMComponentTree and ReactTreeTraversal to figure out if it is a Fiber or Stack instance.

The new failing tests are failing because this is now able to actually fire events onto Fibers and then the result of those events are incorrect where as they were ignored before.

In ReactTreeTraversal we traverse parent based on the type of internal instance it is passed. We could probably optimize this by doing the detection outside each loop and duplicate the loops.

If the parent is a Fiber it may have to traverse multiple steps until it finds a HostComponent since we don't have pointers directly to the next host container.

This will allow us to use the event system with Fiber.

} else if (typeof newProps.dangerouslySetInnerHTML === 'object' &&
newProps.dangerouslySetInnerHTML !== null &&
typeof newProps.dangerouslySetInnerHTML.__html === 'string') {
domElement.innerHTML = newProps.dangerouslySetInnerHTML.__html;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does switching away from dangerouslySetInnerHTML work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is broken in more than one way. We have an issue on it in the Umbrella.

* should control radio buttons
* should control radio buttons if the tree updates during render
* should warn with value and no onChange handler and readOnly specified
* should have a this value of undefined if bind is not used
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this fail? sounds like something that should pass

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the error happens now because the event fires, so the expect does, but not yet sure why it isn't dispatched correctly.

This adds precaching to ReactDOMFiber. I.e. adding a handle from the DOM
node to the internal Fiber. This means that we need to expose an internal
handle to the reconciler.

We use duck typing to figure out if it is a Fiber or Stack instance.

The new failing tests are failing because this is now able to actually
fire events onto Fibers and then the result of those events are
incorrect where as they were ignored before.
This traverses parent based on the type of internal instance it is passed.
If it is a Fiber it may have to traverse multiple steps until it finds a
HostComponent.

This will allow us to use the event system with Fiber.
This makes some basic events work with Fiber.

This is however not a complete solution since we may be reading the wrong
Fiber.
@sebmarkbage sebmarkbage merged commit aca2e04 into facebook:master Nov 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants