Make frontend url and route a cached_property (#122430)

This commit is contained in:
J. Nick Koston 2024-07-23 01:39:18 -05:00 committed by GitHub
parent 975cfa6457
commit 0039f1bb49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@
from __future__ import annotations
from collections.abc import Callable, Iterator
from functools import lru_cache, partial
from functools import cached_property, lru_cache, partial
import logging
import os
import pathlib
@ -588,12 +588,12 @@ class IndexView(web_urldispatcher.AbstractResource):
self.hass = hass
self._template_cache: jinja2.Template | None = None
@property
@cached_property
def canonical(self) -> str:
"""Return resource's canonical path."""
return "/"
@property
@cached_property
def _route(self) -> web_urldispatcher.ResourceRoute:
"""Return the index route."""
return web_urldispatcher.ResourceRoute("GET", self.get, self)