Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not sync ESM component parameters mapped to None #7750

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions panel/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ def __init__(mcs, name: str, bases: tuple[type, ...], dict_: Mapping[str, Any]):
# Create model with unique name
ReactiveMetaBase._name_counter[name] += 1
model_name = f'{name}{ReactiveMetaBase._name_counter[name]}'
ignored = [p for p in Reactive.param if not issubclass(type(mcs.param[p].owner), ReactiveESMMetaclass)]
ignored = [
p for p in Reactive.param
if not issubclass(type(mcs.param[p].owner), ReactiveESMMetaclass)
]
mcs._data_model = construct_data_model(
mcs, name=model_name, ignore=ignored, extras={'esm_constants': param.Dict}
)
Expand Down Expand Up @@ -426,10 +429,10 @@ def _get_properties(self, doc: Document | None) -> dict[str, Any]:
]
for k, v in self.param.values().items():
p = self.param[k]
is_viewable = is_viewable_param(p)
if (k in ignored and k != 'name') or ((p.precedence or 0) < 0) or is_viewable:
if is_viewable and k in props:
props.pop(k)
if is_viewable_param(p) or type(self)._property_mapping.get(k, "") is None:
props.pop(k, None)
continue
elif (k in ignored and k != 'name') or ((p.precedence or 0) < 0):
continue
if k in props:
props.pop(k)
Expand Down Expand Up @@ -486,7 +489,7 @@ def _get_children(self, data_model, doc, root, parent, comm) -> dict[str, list[U
children = {}
for k, v in self.param.values().items():
p = self.param[k]
if not is_viewable_param(p):
if not is_viewable_param(p) or type(self)._property_mapping.get(k, "") is None:
continue
children[k] = self._get_child_model(v, doc, root, parent, comm)
return children
Expand Down
2 changes: 1 addition & 1 deletion panel/io/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def construct_data_model(parameterized, name=None, ignore=[], types={}, extras={
ptype = types.get(pname, type(p))
prop = PARAM_MAPPING.get(ptype)
if isinstance(parameterized, Syncable):
pname = parameterized._rename.get(pname, pname)
pname = parameterized._property_mapping.get(pname, pname)
if pname == 'name' or pname is None:
continue
nullable = getattr(p, 'allow_None', False)
Expand Down
Loading