Skip to content
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: find correct context after rendering empty array #7234

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

Varixo
Copy link
Member

@Varixo Varixo commented Jan 8, 2025

Fix a problem with slot prop for ssr. Empty arrays should be considered as empty content.

@Varixo Varixo self-assigned this Jan 8, 2025
@Varixo Varixo requested a review from a team as a code owner January 8, 2025 17:49
Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: b23eef2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@qwik.dev/core Patch
eslint-plugin-qwik Patch
@qwik.dev/react Patch
@qwik.dev/router Patch
create-qwik Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Varixo Varixo force-pushed the v2-find-context-empty-array branch from 0922571 to b23eef2 Compare January 9, 2025 09:08
Copy link

pkg-pr-new bot commented Jan 9, 2025

Open in Stackblitz

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@7234
npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@7234
npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@7234
npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@7234

commit: b23eef2

Copy link
Contributor

github-actions bot commented Jan 9, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview b23eef2

@@ -141,7 +141,7 @@ export class SsrComponentFrame implements ISsrComponentFrame {
if (isJSXNode(children)) {
const slotName = this.getSlotName(children);
mapArray_set(this.slots, slotName, children, 0);
} else if (Array.isArray(children)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused. The test mentions we should add slot information for an empty array, but in ssr node we're adding an additional guard to only execute when it's not empty.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the code which is responsible to add this is below in the else block :D

Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
3 participants