Skip to content

Commit

Permalink
Close #142. Only attempt to set width/height on altair widget if the …
Browse files Browse the repository at this point in the history
…attributes actually exist.
  • Loading branch information
cpsievert committed Mar 19, 2024
1 parent dcdf2e1 commit 938d3ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [UNRELEASED]

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

## [0.3.1] - 2024-03-01

Expand Down
4 changes: 2 additions & 2 deletions shinywidgets/_render_widget_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ def set_layout_defaults(widget: Widget) -> Tuple[Widget, bool]:
)
else:
UndefinedType = alt.utils.schemapi.UndefinedType # type: ignore
if isinstance(chart.width, UndefinedType): # type: ignore[reportMissingTypeStubs]
if hasattr(chart, "width") and isinstance(chart.width, UndefinedType): # type: ignore[reportMissingTypeStubs]
chart = chart.properties(width="container") # type: ignore
if isinstance(chart.height, UndefinedType): # type: ignore[reportMissingTypeStubs]
if hasattr(chart, "height") and isinstance(chart.height, UndefinedType): # type: ignore[reportMissingTypeStubs]
chart = chart.properties(height="container") # type: ignore
widget.chart = chart

Expand Down

0 comments on commit 938d3ed

Please sign in to comment.