Skip to content

Improve <Show> reference#1163

Merged
LadyBluenotes merged 5 commits intosolidjs:mainfrom
amirhhashemi:update-show-reference
Apr 26, 2025
Merged

Improve <Show> reference#1163
LadyBluenotes merged 5 commits intosolidjs:mainfrom
amirhhashemi:update-show-reference

Conversation

@amirhhashemi
Copy link
Copy Markdown
Collaborator

@amirhhashemi amirhhashemi commented Apr 24, 2025

  • I have read the Contribution guide
  • This PR references an issue (except for typos, broken links, or other minor problems)

Description(required)

This PR improves the reference page for the <Show> component by providing more information about the keyed prop and the render function. I also took the opportunity to clean up and improve the overall structure.

Related: #1164

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 24, 2025

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit 4e5bd33
🔍 Latest deploy log https://app.netlify.com/sites/solid-docs/deploys/680b2a455a92f300083f10e8
😎 Deploy Preview https://deploy-preview-1163--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mizulu
Copy link
Copy Markdown
Contributor

mizulu commented Apr 24, 2025

may address
#1164

@LadyBluenotes LadyBluenotes merged commit 4c77a87 into solidjs:main Apr 26, 2025
7 checks passed
<button onClick={() => setCount((c) => c + 1)}>Increment</button>
{/* This does not update because the count signal is not being tracked. */}
<Show when={count()}>{(c) => count()}</Show>
{/* This will update because the outer JSX element creates a tracking scope. */}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be "inner JSX element" not "outer"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's outer in the sense that it wraps the expression, but I understand that it might be confusing. I don't think "inner JSX element" is necessarily better. Perhaps we can explain it more clearly:

Wrapping the expression in a JSX element creates a tracking scope, which makes it reactive.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

{/* This will update because the returned JSX element creates a new tracking scope. */}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

After further consideration, I have decided to leave it as is. I believe the confusion surrounding the term "outer" is not substantial. Since there are two similar <Show> components, with the only difference being that the second one is wrapped in a fragment, it's easy for users to understand what it means. Additionally, I couldn't think of a phrasing that would meaningfully improve this.

Thank you for your feedback and suggestions. If you disagree with this decision, please feel free to create an issue or pull request so we can discuss it further. Since this PR has already been merged, I prefer to continue the conversation elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants