Skip to content

Commit 938d3ed

Browse files
committed
Close #142. Only attempt to set width/height on altair widget if the attributes actually exist.
1 parent dcdf2e1 commit 938d3ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [UNRELEASED]
99

1010
* Fixed a bug with multiple altair outputs not working inside a `@shiny.render.ui` decorator. (#140)
11+
* `@render_widget` no longer errors out when giving a `altair.FacetChart` class. (#142)
1112

1213
## [0.3.1] - 2024-03-01
1314

shinywidgets/_render_widget_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ def set_layout_defaults(widget: Widget) -> Tuple[Widget, bool]:
210210
)
211211
else:
212212
UndefinedType = alt.utils.schemapi.UndefinedType # type: ignore
213-
if isinstance(chart.width, UndefinedType): # type: ignore[reportMissingTypeStubs]
213+
if hasattr(chart, "width") and isinstance(chart.width, UndefinedType): # type: ignore[reportMissingTypeStubs]
214214
chart = chart.properties(width="container") # type: ignore
215-
if isinstance(chart.height, UndefinedType): # type: ignore[reportMissingTypeStubs]
215+
if hasattr(chart, "height") and isinstance(chart.height, UndefinedType): # type: ignore[reportMissingTypeStubs]
216216
chart = chart.properties(height="container") # type: ignore
217217
widget.chart = chart
218218

0 commit comments

Comments
 (0)