set cache_key

This commit is contained in:
Georges-Antoine Assi
2026-06-18 06:56:38 -04:00
parent fc688f5c16
commit cef5ed0699

View File

@@ -557,7 +557,7 @@ def get_roms(
char_index_dict = {}
if with_char_index:
# The computed positions depend on ordering and grouping, so those
# must be part of the cache key — otherwise switching sort
# must be part of the cache key. Otherwise switching sort
# direction/column (or toggling grouping) reuses a stale index and
# the AlphaStrip highlights the wrong letters.
char_index_cache_key = (
@@ -597,9 +597,15 @@ def get_roms(
smart_collection_id=smart_collection_id,
search_term=search_term,
)
cache_key = (
f"all:u{request.user.id}"
f":o{order_by.lower()}:d{order_dir.lower()}:g{int(group_by_meta_id)}"
if is_unscoped
else None
)
query_filters = db_rom_handler.with_filter_values(
query=filter_query,
cache_key=f"all:u{request.user.id}" if is_unscoped else None,
cache_key=cache_key,
)
# trunk-ignore(mypy/typeddict-item)
filter_values = RomFiltersDict(**query_filters)