Skip to content

Commit

Permalink
web: make ComposeDomNode inline (#1808)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleksandr Karpovich <[email protected]>
(cherry picked from commit 21cda3f)
  • Loading branch information
eymar authored and Oleksandr Karpovich committed Feb 10, 2022
1 parent b3deed4 commit e779768
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ import org.w3c.dom.svg.SVGElement

@Composable
@ExplicitGroupsComposable
private fun <TScope, T> ComposeDomNode(
factory: () -> T,
private inline fun <TScope, T> ComposeDomNode(
crossinline factory: () -> T,
elementScope: TScope,
attrsSkippableUpdate: @Composable SkippableUpdater<T>.() -> Unit,
content: (@Composable TScope.() -> Unit)?
content: (@Composable TScope.() -> Unit)
) {
currentComposer.startNode()
if (currentComposer.inserting) {
currentComposer.createNode(factory)
currentComposer.createNode {
factory()
}
} else {
currentComposer.useNode()
}

attrsSkippableUpdate.invoke(SkippableUpdater(currentComposer))

currentComposer.startReplaceableGroup(0x7ab4aae9)
content?.invoke(elementScope)
content.invoke(elementScope)
currentComposer.endReplaceableGroup()
currentComposer.endNode()
}
Expand Down Expand Up @@ -134,7 +136,9 @@ fun <TElement : Element> TagElement(
}
},
elementScope = scope,
content = content
content = {
content?.invoke(this)
}
)

refEffect?.let { effect ->
Expand Down

0 comments on commit e779768

Please sign in to comment.