From cad424810d55448f1ed58d5ab1c9ed100e2e8b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Wr=C3=B3bel?= Date: Wed, 6 Dec 2023 11:49:09 +0100 Subject: [PATCH] Fix explosion of `already_processed`. `already_processed` was unnecessarily appended and extended during CSS tags generation. --- django_vite/core/asset_loader.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/django_vite/core/asset_loader.py b/django_vite/core/asset_loader.py index 1e12c4c..52642e3 100644 --- a/django_vite/core/asset_loader.py +++ b/django_vite/core/asset_loader.py @@ -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 [] + if already_processed is None: + already_processed = [] tags: List[Tag] = [] 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)