Skip to content

Commit 212acf8

Browse files
authored
Properly cleanup when the Widget is initialized by an implicit as_widget() (#195)
1 parent 03ed44c commit 212acf8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to shinywidgets will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [UNRELEASED]
9+
10+
* Fixed an issue introduced by v0.6.0 where cleanup not happening when it should. (#195)
11+
812
## [0.6.0] - 2025-05-19
913

1014
* Widgets initialized inside a `reactive.effect()` are no longer automatically removed when the effect invalidates. (#191)

shinywidgets/_render_widget_base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ def __init__(
7171

7272
async def render(self) -> Jsonifiable | None:
7373
with WidgetRenderContext(self.output_id):
74-
value = await self.fn()
74+
return await self._render()
75+
76+
async def _render(self) -> Jsonifiable | None:
77+
value = await self.fn()
7578

7679
# Attach value/widget attributes to user func so they can be accessed (in other reactive contexts)
7780
self._value = value

0 commit comments

Comments
 (0)