Skip to content

Commit

Permalink
Allow returning slot from slot initialiser
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiriVulpes committed Dec 28, 2024
1 parent 621952a commit 1995bf7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ui/component/core/Slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const Slot = Object.assign(
cleanup?.()
slot.removeContents()

const result = initialiser(slot, value) || undefined
let result = initialiser(slot, value) || undefined
if (result === slot)
result = undefined

if (Component.is(result)) {
result.appendTo(slot)
cleanup = undefined
Expand All @@ -48,7 +51,10 @@ const Slot = Object.assign(
return
}

const result = initialiser(slot) || undefined
let result = initialiser(slot) || undefined
if (result === slot)
result = undefined

if (Component.is(result)) {
result.appendTo(slot)
cleanup = undefined
Expand Down

0 comments on commit 1995bf7

Please sign in to comment.