-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: calling component as a function #7057
Conversation
|
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
@ianlet thank you for reviewing |
<div> | ||
bar: <div id="1">Test</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this shouldn't be here 😮 that's why this test is passing
with this rendered content, the expected vNode
should be:
<InlineComponent>
<Component>
<div>
bar:
<div>
bar: <div id="1">Test</div>
</div>
</div>
</Component>
</InlineComponent>
and not the one below.
Here, try with this test instead:
it('should render component$ inside inlined wrapper', async () => {
interface ComplexWrapperProps {
foo: string;
}
const ComplexWrapper = (
props: PublicProps<ComplexWrapperProps>,
key: string | null,
flags: number
) => {
const cmpFn = component$<ComplexWrapperProps>(({ foo }) => {
return (
<div>
{foo}: <Slot />
</div>
);
});
return cmpFn(props, key, flags);
};
const { vNode } = await render(<ComplexWrapper foo="bar">Test</ComplexWrapper>, { debug });
expect(vNode).toMatchVDOM(
<InlineComponent>
<Component>
<div>bar: Test</div>
</Component>
</InlineComponent>
);
});
This should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not yet :D
This PR fixes calling a component as a function by returning a jsxSplit with correct props inside component