Confusing Tabs behavior when dynamic=True

Hi there,

I recently discovered the dynamic option for Tabs, which has been great for improving the performance of my app, which has some DynamicMap plots that take a while to render. However, I’m running into an issue where whenever I switch between tabs, the initial rendering state of the tab is reloaded–rather than the current version of the plot based on the stream parameters.

See the following code and video for more details.

import holoviews as hv
import panel as pn
import param
import pandas as pd
import numpy as np

pn.extension(sizing_mode='stretch_both')

class Test(param.Parameterized):
    data = param.DataFrame()
    mult = param.Integer(default=1)
    
    def __init__(self, **kwargs):
        super(Test, self).__init__(**kwargs)
        
        self.plot1_pane = pn.pane.HoloViews(hv.DynamicMap(self.plot1, streams = [self.param.mult]), linked_axes=False)
        self.plot2_pane = pn.pane.HoloViews(hv.DynamicMap(self.plot2, streams = [self.param.mult]), linked_axes=False)
    
    def plot1(self, mult):
        return hv.HoloMap({i: hv.Curve(self.data) for i in range(1, mult+1)}).overlay().opts(responsive=True)
    
    def plot2(self, mult):
        return hv.HoloMap({i: hv.Curve(self.data) for i in range(1, mult+1)}).overlay().opts(responsive=True)
    
df = pd.DataFrame(np.array([[0, 1, 2, 3, 4], list(range(5))]).T, columns = ['x', 'y'])    
test = Test(data=df)

tabs = pn.Tabs(
    test.plot1_pane, 
    test.plot2_pane, 
    dynamic=True
)

pn.Column(
    pn.Param(test, parameters = ['mult']),
    tabs, height=500
)

Any advice on how to fix this issue would be greatly appreciated…

Thanks!

This seems to be fixed on master. So it should work for you with the new release of panel coming soon. :slight_smile:

Yep master caches the existing panel so this should indeed be fixed. If you want to try I’d encourage you to test with the 0.13.0 release candidate.

Thanks for confirming. Glad I can look forward to this in the next release!