Dear community,
I encountered an issue when working with ReactiveHTML components after upgrading to panel==1.5.5
. Below is a small example that demonstrates the problem.
I have a single CheckBoxGroup
widget with two options: “A” and “B.” In the example, “A” is selected by default. When I deselect it (leaving no options selected), Panel throws the following error:
AttributeError: ‘str’ object has no attribute ‘name’
mapping = {o.name: o for o in old}
It appears that at least one element must remain selected so there is an object with a .name
attribute. This worked fine before upgrading to panel==1.5.5
. In version 1.5.4
, it would simply return an empty array, which was acceptable behavior.
I would greatly appreciate any guidance on how to resolve or work around this issue.
Thank you,
With best regards,
Sergey
import panel as pn
import param
from panel.reactive import ReactiveHTML
pn.extension()
class CustomComponent(ReactiveHTML):
groups = param.ListSelector(
default=["A"],
objects=["A", "B"],
)
_scripts = {
"groups": """console.log(data.groups)""",
}
component = CustomComponent()
groupWidget = pn.widgets.CheckBoxGroup.from_param(
component.param.groups,
name="Group",
value=["A"],
options=["A", "B"],
inline=True,
)
pn.Column(groupWidget, component).servable()