Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nasty-views-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': patch
---

fix: removing children from var props
6 changes: 3 additions & 3 deletions packages/qwik/src/core/shared/jsx/jsx-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ export const _jsxSplit = <T extends string | FunctionComponent<any>>(
for (const k in varProps) {
if (k === 'children') {
children ||= varProps.children as JSXChildren;
varProps.children = undefined;
delete varProps.children;
} else if (k === 'key') {
key ||= varProps.key as string;
varProps.key = undefined;
delete varProps.key;
} else if (constProps && k in constProps) {
varProps[k] = undefined;
delete varProps[k];
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions packages/qwik/src/core/tests/inline-component.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Fragment as Signal,
Slot,
component$,
jsx,
useSignal,
useStore,
useVisibleTask$,
Expand Down Expand Up @@ -41,6 +42,16 @@ const ChildInline = () => {
return <div>Child inline</div>;
};

const OwnKeys = {
HAccordionRoot: (props: any) => {
return jsx('div', props);
},
Root: (props: any) => <OwnKeys.HAccordionRoot {...props} accordionItemComponent={OwnKeys.Item} />,
Item: component$(() => {
return <></>;
}),
};

describe.each([
{ render: ssrRenderToDom }, //
{ render: domRender }, //
Expand Down Expand Up @@ -732,4 +743,16 @@ describe.each([
</InlineComponent>
);
});

it('should remove children from varProps and not throw', async () => {
const Cmp = component$(() => {
return (
<OwnKeys.Root class="w-96">
<OwnKeys.Item />
</OwnKeys.Root>
);
});

await expect(render(<Cmp />, { debug })).resolves.not.toThrow();
});
});