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

SSR error when parent components pass values to child components and also have refs #221

Closed
alizauf opened this issue Dec 21, 2016 · 2 comments · Fixed by #226
Closed

SSR error when parent components pass values to child components and also have refs #221

alizauf opened this issue Dec 21, 2016 · 2 comments · Fixed by #226

Comments

@alizauf
Copy link

alizauf commented Dec 21, 2016

I found a bug when placing a ref on a component, which is now possible, after #216 was resolved.

If the parent component is passing values to the child component, the ref needs to go at the end of the line, otherwise the below error is produced.

So this works:
<Background scenes='{{scenes}}' sceneIndex='{{sceneIndex}}' position='{{position}}' mode='{{mode}}' fix='{{fix}}' ref:backgroundRef />

But this doesn't:
<Background ref:backgroundRef scenes='{{scenes}}' sceneIndex='{{sceneIndex}}' position='{{position}}' mode='{{mode}}' fix='{{fix}}' />

Stack trace

Unexpected token (114:44)
SyntaxError: Unexpected token (114:44)
at Parser.pp$4.raise (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp$3.parseIdent (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:2189:12)
at Parser.parseIdent (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/acorn-es7-plugin/acorn-v3.js:111:31)
at Parser.pp$3.parsePropertyName (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:2052:101)
at Parser.parsePropertyName (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/acorn-es7-plugin/acorn-v3.js:257:28)
at Parser.pp$3.parseObj (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:1988:14)
at Parser.pp$3.parseExprAtom (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:1805:19)
at Parser.parseExprAtom (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/acorn-es7-plugin/acorn-v3.js:125:30)
at Parser.pp$3.parseExprSubscripts (/Users/aliza.aufrichtig/Sites/2016-12-local-guns/node_modules/reify/node_modules/acorn/dist/acorn.js:1715:21)

@alizauf
Copy link
Author

alizauf commented Dec 21, 2016

The same issue occurs with bind.

This works:
<Background scenes='{{scenes}}' sceneIndex='{{sceneIndex}}' position='{{position}}' mode='{{mode}}' fix='{{fix}}' bind:sceneIndex />

This throws the same error as above:
<Background bind:sceneIndex scenes='{{scenes}}' sceneIndex='{{sceneIndex}}' position='{{position}}' mode='{{mode}}' fix='{{fix}}' />

@Rich-Harris
Copy link
Member

Thanks – fixed in 1.6.1

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 a pull request may close this issue.

2 participants