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 error when component has object as props #967

Closed
wants to merge 1 commit into from

Conversation

darekrossman
Copy link
Contributor

When attempting to render a component's props in the story source pane – when a component has an object for a prop like style, previewProp() was attempting to render a literal object with the key content, which causes a React error. Seems the intention of the original code was to render the literal characters "{" and "}" around content.

Issue:

What I did

Changed the final case in previewProp where content was being set as a <span>. Replaced intended functionality to render literal brace characters.

How to test

Cloned the latest branch and attempted to link addons-info in another project.

.addWithInfo('div', () => (
  <div style={{ color: 'red' }}>Oops</div>
)

Seems passing in any object as ay prop triggers a React error.

When attempting to render a component's props in the story source pane – when a component has an object for a prop like `style`, `previewProp()` was attempting to render a literal object with the key `content`, which causes a React error. Seems the intention of the original code was to render the literal characters `"{"` and `"}"` around `content`.
Copy link

nx-cloud bot commented Mar 15, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 0a85d31. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

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.

2 participants