You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #1247 [TwigComponents] Fixing inconsistency with how {% component rendered vs {{ component() (weaverryan)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[TwigComponents] Fixing inconsistency with how {% component rendered vs {{ component()
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Issues | Fix#1205 (?) and maybe others?
| License | MIT
tl;dr `{% component` was rendered slightly differently than `{{ component`. Additionally, for `{% component`, the template was determined too early, which didn't allow for the template to be overridden via an event.
**Longer Explanation**
This cleans up `ComponentTokenParser`, removing some unnecessary parts. We now always set the "embedded" component parent to a magic `__parent__` variable. This allows us to delay the determination of the component template until runtime, after the `PreRenderEvent` has been called.
TODO:
* [ ] Bring in tests from #1236 and #1237 and check other tests
* [ ] Check #1205 to verify this fixes
* [ ] Check debug:twig-component command for any changes needed
Cheers!
Commits
-------
df6388e [TwigComponents] Fixing inconsistency with how {% component rendered vs {{ component()
0 commit comments