Autodesk / orion-ui

UI Components that work seamlessly in multiple UI frameworks
https://goo.gl/shxHPB
Other
22 stars 6 forks source link

fix insert between children issue #228

Closed camwest closed 7 years ago

camwest commented 7 years ago

Fixes #222

Description

Motivation and Context

Previously we were swapping the created react DOM instance with an HTML comment to keep the document free from extraneous divs. This was causing a problem in the React stack renderer here: https://github.com/facebook/react/blob/b1768b5a48d1f82e4ef4150e0036c5f846d3758a/src/renderers/dom/stack/client/DOMChildrenOperations.js#L48 because insertBefore was inserting the DOM elements incorrectly (with an orphaned element reference)

Now we only swap for html comment anchors for the first HTML element in the HIG context. Lower level components do not do this so that React can reconcile children relative to each other correctly. This means that React is reconciling on an orphaned fragment of DOM elements, but it works fine!

The second piece of code here improves the HIGNodeList to manage the entire child node lifecycle. This means it's easy to create a collection of children in a component just by delegating certain methods to the HIGNodeList.

How Has This Been Tested?

I added a new test for inserting a child node in between two other nodes in the Tabs.test

Types of changes

Checklist:

camwest commented 7 years ago

@nfiniteset yeah should be much easier to manage now