Does Surface UI Support Nested, *Dynamic*, LiveComponents?


I’m currently trying to port an existing application to use the Surface Framework. It makes heavy use of LiveComponents, often nested inside one another.

With vanilla LiveComponents, the below method for rendering dynamic components worked well, (get_type/1 would return the type of the component based on a string lookup.)

<%= live_component(get_type(child.type), node: child)%>

Trying the same thing in Surface using its DynamicComponent (Surface.Components.Dynamic.Component) also works.

<Component module={get_type(child.type)} node={child} />

But the behaviour is different. With Vanilla LiveComponents all the lifecycle methods of the dynamically rendered component get called (mount/1, update/2 and render/1).

With the Surface version, however, only the render/1 method gets called, even though the component is based on Surface.LiveComponent.

Sooo… Has anyone else tried this? Does Surface support nesting components in this way?

Any help would be much appreciated, this is (I believe) the final blocker for me being able to use Surface throughout.

OK, so on digging a little deeper, it looks like some lovely individual submitted a PR for this just a few weeks ago! Looks like I just need to wait for a new release.