Skip to content

Commit a18948e

Browse files
committed
modified webpack_loader_used_tags context variable to use sets
1 parent 1fab452 commit a18948e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

webpack_loader/templatetags/webpack_loader.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ def render_bundle(context, bundle_name, extension=None, config='DEFAULT', suffix
1313
bundle_name, extension=extension, config=config,
1414
suffix=suffix, attrs=attrs, is_preload=is_preload
1515
)
16-
used_tags = context.get("webpack_loader_used_tags", [])
17-
if not used_tags:
18-
context["webpack_loader_used_tags"] = []
16+
if "webpack_loader_used_tags" not in context:
17+
context["webpack_loader_used_tags"] = set()
18+
used_tags = context["webpack_loader_used_tags"]
1919
if skip_common_chunks:
2020
tags = [mark_safe(tag) for tag in tags if tag not in used_tags]
21+
context["webpack_loader_used_tags"].update(tags)
2122

22-
context["webpack_loader_used_tags"] = context["webpack_loader_used_tags"] + tags
23-
2423
return mark_safe('\n'.join(tags))
2524

2625
@register.simple_tag

0 commit comments

Comments
 (0)