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

Passing a text prop to a component unexpectedly adds the prop value as a child #503

Closed
kmdupr33 opened this issue May 27, 2019 · 3 comments
Assignees
Labels

Comments

@kmdupr33
Copy link
Contributor

To Reproduce

See this saved idyll editor, which simply has [div text:"Hello" /] in the editor side and shows "hello" as output.

Expected behavior
I don't expect the value of a text prop to show up as a child of the component.

Screenshots
image

Desktop (please complete the following information):

  • Browser Chrome
  • Version 74.0.3729.169
@mathisonian
Copy link
Member

Weird!

I'm not sure if this is a React behavior or an idyll introduced error. Going to look into this more and report back.

@mathisonian mathisonian self-assigned this May 28, 2019
@kmdupr33
Copy link
Contributor Author

Yeah I had the same thought. I checked that, however. It doesn't appear to be a feature of react.

@mathisonian
Copy link
Member

Thanks for checking that out. This seems to be related to how we're representing components via a JSON schema. You can see the bug here https://github.com/idyll-lang/idyll/blob/master/packages/idyll-document/src/utils/schema2element.js#L43-L46. I believe that check could be safely removed as we don't set the text property anywhere when generating the schema from the AST.

mathisonian added a commit that referenced this issue May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants