panel icon indicating copy to clipboard operation
panel copied to clipboard

Addressing `REPEATED_LAYOUT_CHILD` warning in align cards exercise

Open jrycw opened this issue 1 year ago • 5 comments
trafficstars

I'm currently working on the exercise Align Cards. However, it seems that the provided solution using Align + Spacer issued a warning message in the terminal: E-1027 (REPEATED_LAYOUT_CHILD): The same model can't be used multiple times in a layout: Column(id='p1029', ...). This warning is likely triggered by using spacer object twice. Should we consider using two pn.Spacer to resolve the issue?

jrycw avatar Apr 05 '24 03:04 jrycw

I will change this.

But its unclear to me when you can reuse Panel components in general. For example I sometimes instantiate a Markdown pane with a general description of the app in a separate module and then use for all users/ sessions. The purpose is to speed up the app by only instantiating once. What is the general rule/ guidance @philippjfr ?

Its really great to get feedback on the tutorials @jrycw. They are brand new and need some feedback to improve.

MarcSkovMadsen avatar Apr 05 '24 06:04 MarcSkovMadsen

But its unclear to me when you can reuse Panel components in general.

This error originates from bokeh and the root cause is bokehjs' design. bokehjs holds a mapping between models and their views for every property that is used for creating views, such as LayoutDOM.children, UIElement.elements, Toolbar.tools, etc. In general one model may have multiple views, as long as one doesn't repeat the given model in one of such properties. There is a simple workaround to this limitation, wrap a repeated model in another model, e.g. a layout container in this case, or clone the model, if you don't intent to share state between views.

mattpap avatar Apr 05 '24 07:04 mattpap

To be fixed by #6682

MarcSkovMadsen avatar Apr 06 '24 03:04 MarcSkovMadsen

May I understand the reason for reopening this issue?

jrycw avatar Apr 08 '24 14:04 jrycw

Since Panel wraps Bokeh we can actually do something about the problem that @mattpap describes. So while we've updated the docs for now to avoid this issue we can actually fix the issue entirely.

philippjfr avatar Apr 08 '24 15:04 philippjfr