Skip to content

v0.11.0

Compare
Choose a tag to compare
@ryansolid ryansolid released this 18 Jul 08:30

Major Breaking Changes

This release removes several features by taking a fundamental architecture switch. Overall this is a huge simplification and code reduction.

Removing Control Flow

Instead of hard compiling Control Flows, the library is putting the work on Components in userland. This is infinitely more flexible and opens up different solutions to fit the library that uses it. It meant beefing up the core reconciler to be able to handle pretty much whatever gets thrown at it.

Fragments as Arrays

Document Fragments have this pesky characteristic of losing their child nodes. Using arrays is a must if you wish to retain references and pass them around. Which is necessary change if control flow is outside of the main library. This reduces the Node creation in many places, but it also means multi-nested fragments end up getting reconciled all at the same time on update. So there are some performance characteristic changes.

insert at entry

With these changes, the returned code from JSX is no longer guaranteed to be a DOM node. It may be an array or a function. In so if you use top-level child components or fragments your mount method should use insert to ensure different inputs are handled properly.

props.children changes

Now when you pass a single child you get a single value and multi-children are represented as arrays. This is consistent with how React handles children and allows a lot of different capacities for Component design. JSX element children by default are handled as dynamic and are lazily evaluated. Allowing for more powerful templating with Components.

Removing Custom Directives

Also, custom directives have been removed. They were a confusing alternative way to do things and did not play well with Typescript. Using forwardRef can achieve the same thing. The naming is under consideration and whether the library should be concerned with multiple instances on the same element (technically it works).

Better TypeScript support

Removal of Control Flow, Custom Directives, and consistent handling of JSX Children all improve TypeScript support.

Wide Open Future

While on the surface many of these changes may seem like detractors this widely opens up the ecosystem. Components or custom methods can benefit from all the performance capable here. The reactive system feeds into the renderer instead of being so closely entwined. It makes custom logic much simpler to write in the libraries without having to worry about markers and node ranges.

Look forward to updates in related Libraries over the coming weeks.