Skip to content

Commit 6fabf0a

Browse files
authored
chore: Cleanup silly fragment usage (#126)
1 parent dd1f1d6 commit 6fabf0a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, cloneElement, render, hydrate, Fragment } from 'preact';
1+
import { h, cloneElement, render, hydrate } from 'preact';
22

33
/**
44
* @typedef {import('./internal.d.ts').PreactCustomElement} PreactCustomElement
@@ -177,8 +177,7 @@ function Slot(props, context) {
177177
}
178178
}
179179
};
180-
const { useFragment, ...rest } = props;
181-
return h(useFragment ? Fragment : 'slot', { ...rest, ref });
180+
return h('slot', { ...props, ref });
182181
}
183182

184183
function toVdom(element, nodeName, options) {
@@ -210,9 +209,8 @@ function toVdom(element, nodeName, options) {
210209
const shadow = !!(options && options.shadow);
211210

212211
// Only wrap the topmost node with a slot
213-
const wrappedChildren = nodeName
214-
? h(Slot, { useFragment: !shadow }, children)
215-
: children;
212+
const wrappedChildren =
213+
nodeName && shadow ? h(Slot, null, children) : children;
216214

217215
if (!shadow && nodeName) {
218216
element.innerHTML = '';

0 commit comments

Comments
 (0)