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

Partial blocks are dodgy #54

Open
thumphries opened this issue May 26, 2016 · 2 comments
Open

Partial blocks are dodgy #54

thumphries opened this issue May 26, 2016 · 2 comments

Comments

@thumphries
Copy link
Contributor

Partial blocks are supposed to be evaluated in the calling context, for some reason. This has been implemented rather quickly by evaluating the block before running the partial and inlining the result as text.

i.e.

  • {{>@partial-block }} will always work
  • {{>@partial-block custom-context abc=def }} might succeed and be incorrect
  • {{>@partial-block abc=def }} will succeed and be incorrect if abc is defined in the outer scope

This could be fixed with quite a bit of work. It's not simple, because we need to stash the outer context and figure out which one to use when @partial-block is called. there's no sane way to do it, would have to lace the partial rendering code with special cases.

In the meantime, avoid passing arguments to a partial block

@damncabbage @charleso @russ-ambiata

@damncabbage
Copy link
Contributor

Ow wow; I didn't know you could even do that. Thanks for the warning.

@thumphries
Copy link
Contributor Author

Yeah we definitely went over this a few months ago when I decided not to fix it. Overriding stuff in the partial-block really doesn't make sense to me, I don't think it should be allowed.

Just wanted to make sure it's in our handlebars guidelines. Since it's just inlined text, it'll render almost every time.

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

No branches or pull requests

2 participants