Skip to content

Commit ed456f6

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 27528ad + 37c7178 commit ed456f6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
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 an issue where widgets would sometimes fail to render in a Quarto document. (#159)
11+
* Fixed an issue where importing shinywidgets before a ipywidget implementation can sometimes error in a Shiny Express app. (#163)
1112

1213
## [0.3.3] - 2024-08-13
1314

shinywidgets/_shinywidgets.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def init_shiny_widget(w: Widget):
4545
raise RuntimeError(
4646
"shinywidgets requires that all ipywidgets be constructed within an active Shiny session"
4747
)
48+
# Wait until we're in a "real" session before doing anything
49+
# (i.e., on the 1st run of an Express app, it's too early to do anything)
50+
if session.is_stub_session():
51+
return
4852
# Break out of any module-specific session. Otherwise, input.shinywidgets_comm_send
4953
# will be some module-specific copy.
5054
while hasattr(session, "_parent"):

0 commit comments

Comments
 (0)