Reset template state cache

This commit is contained in:
Erik
2025-04-30 16:04:12 +02:00
parent 4d5e809e9b
commit 8beddd2481

View File

@@ -96,6 +96,7 @@ from homeassistant.helpers import (
issue_registry as ir, issue_registry as ir,
label_registry as lr, label_registry as lr,
recorder as recorder_helper, recorder as recorder_helper,
template,
translation as translation_helper, translation as translation_helper,
) )
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
@@ -472,6 +473,10 @@ def reset_globals() -> Generator[None]:
# Reset the aiohttp cache # Reset the aiohttp cache
web_app._cached_build_middleware.cache_clear() web_app._cached_build_middleware.cache_clear()
# Reset the template cache
template.CACHED_TEMPLATE_LRU.clear()
template.CACHED_TEMPLATE_NO_COLLECT_LRU.clear()
# Reset patch_json # Reset patch_json
if patch_json.mock_objects: if patch_json.mock_objects:
obj = patch_json.mock_objects.pop() obj = patch_json.mock_objects.pop()