Skip to content

Commit

Permalink
Cache based on server
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 12, 2024
1 parent 5cb3f9f commit 7645f26
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions panel/theme/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ResourceComponent, component_resource_path, get_dist_path,
resolve_custom_path,
)
from ..io.state import state
from ..util import relative_to

if TYPE_CHECKING:
Expand Down Expand Up @@ -157,7 +158,7 @@ def _resolve_stylesheets(cls, value, defining_cls, inherited):

@classmethod
@functools.lru_cache
def _resolve_modifiers(cls, vtype, theme):
def _resolve_modifiers(cls, vtype, theme, is_server=False):
"""
Iterate over the class hierarchy in reverse order and accumulate
all modifiers that apply to the objects class and its super classes.
Expand Down Expand Up @@ -185,8 +186,9 @@ def _get_modifiers(
from ..io.resources import (
CDN_DIST, component_resource_path, resolve_custom_path,
)
theme_type = type(theme) if isinstance(theme, Theme) else theme
modifiers, child_modifiers = cls._resolve_modifiers(type(viewable), theme_type)
theme_type = type(theme) if isinstance(theme, Theme) else theme
is_server = bool(state.curdoc.session_context) if not state._is_pyodide and state.curdoc else False
modifiers, child_modifiers = cls._resolve_modifiers(type(viewable), theme_type, is_server=is_server)
modifiers = dict(modifiers)
if 'stylesheets' in modifiers:
if isolated:
Expand Down

0 comments on commit 7645f26

Please sign in to comment.