diff --git a/src/bokeh/server/views/static_handler.py b/src/bokeh/server/views/static_handler.py index 94111160841..0a5ea96ab3f 100644 --- a/src/bokeh/server/views/static_handler.py +++ b/src/bokeh/server/views/static_handler.py @@ -69,7 +69,9 @@ def append_version(cls, path: str) -> str: if settings.dev: return path else: - version = StaticFileHandler.get_version(dict(static_path=settings.bokehjs_path()), path) + if not hasattr(cls, "_static_path_cache"): + cls._static_path_cache = dict(static_path=settings.bokehjs_path()) + version = StaticFileHandler.get_version(cls._static_path_cache, path) return f"{path}?v={version}" #----------------------------------------------------------------------------- diff --git a/src/bokeh/settings.py b/src/bokeh/settings.py index 9cd8351eb28..fa078307763 100644 --- a/src/bokeh/settings.py +++ b/src/bokeh/settings.py @@ -121,17 +121,8 @@ from enum import Enum, auto from os.path import join from pathlib import Path -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Generic, - Literal, - Sequence, - TypeAlias, - TypeVar, - cast, -) +from typing import (TYPE_CHECKING, Any, Callable, Generic, Literal, Sequence, + TypeAlias, TypeVar, cast) # External imports import yaml