From 55856e1b17850129144b9dd0d27fcc2b770c76a3 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 8 Jul 2024 17:29:36 +0200 Subject: [PATCH] Freeze models while updating plot(s) (#6315) --- holoviews/plotting/bokeh/util.py | 16 ++++++++++++---- pixi.toml | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/holoviews/plotting/bokeh/util.py b/holoviews/plotting/bokeh/util.py index 4abaf67b56..cdd5baea64 100644 --- a/holoviews/plotting/bokeh/util.py +++ b/holoviews/plotting/bokeh/util.py @@ -863,11 +863,19 @@ def hold_render(f): """ def wrapper(self, *args, **kwargs): hold = self.state.hold_render + doc = self.state.document self.state.hold_render = True - try: - return f(self, *args, **kwargs) - finally: - self.state.hold_render = hold + if doc: + with doc.models.freeze(): + try: + return f(self, *args, **kwargs) + finally: + self.state.hold_render = hold + else: + try: + return f(self, *args, **kwargs) + finally: + self.state.hold_render = hold return wrapper diff --git a/pixi.toml b/pixi.toml index b0313edddb..bfceddae29 100644 --- a/pixi.toml +++ b/pixi.toml @@ -40,6 +40,7 @@ plotly = ">=4.0" [feature.py39.dependencies] python = "3.9.*" +ffmpeg = "<7" [feature.py310.dependencies] python = "3.10.*"