Skip to content

Commit 4e8a0cd

Browse files
committed
revert: Silly broken code
1 parent 0a8ccf7 commit 4e8a0cd

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

package-lock.json

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)