diff --git a/holoviews/core/decollate.py b/holoviews/core/decollate.py index 91581ab8d9..986858d12a 100644 --- a/holoviews/core/decollate.py +++ b/holoviews/core/decollate.py @@ -140,7 +140,7 @@ def to_expr_extract_streams( else: # Add new stream stream_index = StreamIndex(index=len(streams)) - cloned_stream = type(hvobj)(**hvobj.contents) + cloned_stream = hvobj.clone() original_streams.append(hvobj) streams.append(cloned_stream) if container_key is not None: diff --git a/holoviews/streams.py b/holoviews/streams.py index d872722aa0..a0cee9f811 100644 --- a/holoviews/streams.py +++ b/holoviews/streams.py @@ -264,6 +264,9 @@ def __init__(self, rename={}, source=None, subscribers=[], linked=False, else: self.registry[source] = [self] + def clone(self): + """Return new stream with identical properties and no subscribers""" + return type(self)(**self.contents) @property def subscribers(self): @@ -870,6 +873,9 @@ def __init__(self, input_stream, **params): # added to our values list self.input_stream.event() + def clone(self): + return type(self)(self.input_stream.clone(), **self.contents) + def clear_history(self): del self.values[:] self.event() @@ -921,6 +927,9 @@ def __init__(self, source, **params): source=source, input_streams=input_streams, exclusive=True, **params ) + def clone(self): + return type(self)(self.source, **self.contents) + def _build_selection_streams(self, source): from holoviews.core.spaces import DynamicMap if isinstance(source, DynamicMap):