Skip to content

Commit

Permalink
Fix explosion of already_processed.
Browse files Browse the repository at this point in the history
`already_processed` was unnecessarily appended and extended during CSS
tags generation.
  • Loading branch information
amw committed Dec 6, 2023
1 parent 302f625 commit fa67033
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions django_vite/core/asset_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,23 +449,22 @@ def _generate_css_files_of_asset(
tags -- List of CSS tags.
already_processed -- List of already processed css paths
"""
already_processed = already_processed or []
tags: List[Tag] = []
if already_processed is None:
already_processed = []
manifest_entry = self.manifest.get(path)

for import_path in manifest_entry.imports:
new_tags, new_already_processed = self._generate_css_files_of_asset(
new_tags, _ = self._generate_css_files_of_asset(
import_path, already_processed, tag_generator
)
tags.extend(new_tags)
already_processed.extend(new_already_processed)

for css_path in manifest_entry.css:
if css_path not in already_processed:
url = self._get_production_server_url(css_path)
tags.append(tag_generator(url))

already_processed.append(css_path)
already_processed.append(css_path)

return self.GeneratedCssFilesOutput(tags, already_processed)

Expand Down

0 comments on commit fa67033

Please sign in to comment.