diff --git a/CHANGELOG.md b/CHANGELOG.md index 9095791..efaf454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ This format follows Keep a Changelog principles and aims for Semantic Versioning ## [Unreleased] ### Summary -Theme catalog improvements with faster processing, new tag search features, and regeneration fixes. +Theme catalog improvements with faster processing, new tag search features, regeneration fixes, and browser performance optimizations. ### Added - **Theme Catalog Optimization**: @@ -18,9 +18,13 @@ Theme catalog improvements with faster processing, new tag search features, and - Tag search API with new endpoints for card search, autocomplete, and popular tags - Commander browser theme autocomplete with keyboard navigation - Tag loading infrastructure for batch operations +- **Theme Browser Keyboard Navigation**: Arrow keys now navigate search results (ArrowUp/Down, Enter to select, Escape to close) ### Changed -_No unreleased changes yet._ +- **Theme Browser Performance**: Theme detail pages now load much faster + - Disabled YAML file scanning in production (use `THEME_CATALOG_CHECK_YAML_CHANGES=1` during theme authoring) + - Cache invalidation now checks theme_list.json instead of scanning all files +- **Theme Browser UI**: Removed color filter from theme catalog ### Fixed - **Theme Regeneration**: Theme catalog can now be fully rebuilt from scratch without placeholder data diff --git a/RELEASE_NOTES_TEMPLATE.md b/RELEASE_NOTES_TEMPLATE.md index c184223..8dcdb2c 100644 --- a/RELEASE_NOTES_TEMPLATE.md +++ b/RELEASE_NOTES_TEMPLATE.md @@ -1,7 +1,7 @@ # MTG Python Deckbuilder ${VERSION} ### Summary -Theme catalog improvements with faster processing, tag search features, and regeneration fixes. +Theme catalog improvements with faster processing, tag search features, regeneration fixes, and browser performance optimizations. ### Added - **Theme Catalog Optimization**: @@ -9,13 +9,15 @@ Theme catalog improvements with faster processing, tag search features, and rege - Tag search API for theme-based card discovery - Commander browser theme autocomplete with keyboard navigation - Tag index for faster queries +- **Theme Browser Keyboard Navigation**: Arrow keys navigate search results (ArrowUp/Down, Enter, Escape) - **Card Data Consolidation** (from previous release): - Optimized format with smaller file sizes - "Rebuild Card Files" button in Setup page - Automatic updates after tagging/setup ### Changed -_No unreleased changes yet._ +- **Theme Browser Performance**: Theme pages now load much faster +- **Theme Browser UI**: Removed color filter for cleaner interface ### Fixed - **Theme Regeneration**: Theme catalog can now be fully rebuilt from scratch diff --git a/code/web/services/theme_catalog_loader.py b/code/web/services/theme_catalog_loader.py index c5a88e2..9212b78 100644 --- a/code/web/services/theme_catalog_loader.py +++ b/code/web/services/theme_catalog_loader.py @@ -102,6 +102,14 @@ def _needs_reload() -> bool: return True if mtime > idx.mtime: return True + + # OPTIMIZATION: Skip YAML scanning unless explicitly enabled via env var. + # Checking 732 YAML files takes ~800ms and is only needed during theme authoring. + # In production, theme_list.json is the source of truth (built from YAMLs offline). + import os as _os + if _os.getenv("THEME_CATALOG_CHECK_YAML_CHANGES") != "1": + return False + # If any YAML newer than catalog mtime or newest YAML newer than cached scan -> reload if YAML_DIR.exists(): import time as _t @@ -113,7 +121,6 @@ def _needs_reload() -> bool: # Fast path: use os.scandir for lower overhead vs Path.glob newest = 0.0 try: - import os as _os with _os.scandir(YAML_DIR) as it: # type: ignore[arg-type] for entry in it: if entry.is_file() and entry.name.endswith('.yml'): diff --git a/code/web/templates/themes/catalog_simple.html b/code/web/templates/themes/catalog_simple.html index 529b2c5..50c0814 100644 --- a/code/web/templates/themes/catalog_simple.html +++ b/code/web/templates/themes/catalog_simple.html @@ -19,14 +19,6 @@ -
- -
- {% for c in ['W','U','B','R','G'] %} - - {% endfor %} -
-
@@ -42,9 +34,10 @@