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

Using {...spread} alongside ternary errors out #1515

Closed
kaisermann opened this issue May 30, 2018 · 2 comments
Closed

Using {...spread} alongside ternary errors out #1515

kaisermann opened this issue May 30, 2018 · 2 comments
Assignees
Labels

Comments

@kaisermann
Copy link
Member

REPL

If you have some attribute defined by a ternary operator and try to spread some object, this happens:

image

@Conduitry
Copy link
Member

It looks like this actually happens when any attribute in an element using spreads (or prop in a component using spreads) has two or more dependencies. It's an order of operations thing. In the code for this REPL example, we're generating changed.visible || changed.value && { value: ctx.visible ? ctx.value : '****' } when we ought to be generating (changed.visible || changed.value) && { value: ctx.visible ? ctx.value : '****' }. We need to make sure we wrap the conditions here and here in parentheses as appropriate. PR coming in a bit.

@Conduitry
Copy link
Member

Opened PR #1516.

Rich-Harris added a commit that referenced this issue Jun 5, 2018
fix spread when an attribute or prop has multiple dependencies
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