Fix infinite recursion bug (fixes #68) (#74)

* Add regression test for recursion bug, #68

* Only allow slots to access slot nodelists provided to their immediate parent component to prevent infinite recursions.

* Fix import ordering bug in test

* Add slot.super to docs

Remove unused imports

* Bump version

Co-authored-by: rbeard0330 <@dul2k3BKW6m>
This commit is contained in:
rbeard0330 2021-07-06 11:56:49 -04:00 committed by GitHub
parent 7f4661922a
commit e3c9ac76ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 13 deletions

View file

@ -114,8 +114,7 @@ class Component(metaclass=SimplifiedInterfaceMediaDefiningClass):
def render(self, context):
template_name = self.template(context)
instance_template = self.get_processed_template(template_name)
active_slots = {**context.get(ACTIVE_SLOT_CONTEXT_KEY, {}), **self.slots}
with context.update({ACTIVE_SLOT_CONTEXT_KEY: active_slots}):
with context.update({ACTIVE_SLOT_CONTEXT_KEY: self.slots}):
return instance_template.render(context)
class Media: