Closed JuroOravec closed 2 weeks ago
This looks great. And the new documentation section about slot rendering is super useful. Thank you, Juro!
The only thing I noticed is that there were some small formatting changes in the README. I wonder if we should use a pre-commit hook for md files? Because whenever I change the README, the same thing happens.
@dylanjcastillo Thanks!
On README formatting - Yeah I think I would be good to have README linted too, do you know how to set it up?
I’ll give it a go in the coming days!
This MR:
Removes the nodes and template tags involved in the If/Elif/Else logic (
{% if_filled %}
, etc). Instead, the context is populated with a slots dict that tracks which slots have been filled, and can be used like{% if component_vars.is_filled.<slot_name> %}
Merges
context_behavior
andslot_context_behavior
intocontext_behavior
. It now has two options -"isolated"
and"django"
(this was previously calledglobal
).isolated
is the default.Revamps the slot resolution logic. It has now been moved "upstream", meaning that the slot resolution is now done in
Component.render()
. And so, by the time we reachSlotNode.render()
, we only need to look up the corresponding slot fill.To make it easier to onboard people to the slot resolution flow, I've documented the flow in docs/slot_rendering.md
Updates README
See other comments for smaller changes
This is a big MR, but also about 2/3 of it are documentation and test changes.
Closes https://github.com/EmilStenstrom/django-components/issues/280 Closes https://github.com/EmilStenstrom/django-components/issues/450