diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f071fc..87906cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to shinywidgets will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +* Fixed an issue introduced by v0.6.0 where cleanup not happening when it should. (#195) + ## [0.6.0] - 2025-05-19 * Widgets initialized inside a `reactive.effect()` are no longer automatically removed when the effect invalidates. (#191) diff --git a/shinywidgets/_render_widget_base.py b/shinywidgets/_render_widget_base.py index fb6ac52..5e8021a 100644 --- a/shinywidgets/_render_widget_base.py +++ b/shinywidgets/_render_widget_base.py @@ -71,7 +71,10 @@ def __init__( async def render(self) -> Jsonifiable | None: with WidgetRenderContext(self.output_id): - value = await self.fn() + return await self._render() + + async def _render(self) -> Jsonifiable | None: + value = await self.fn() # Attach value/widget attributes to user func so they can be accessed (in other reactive contexts) self._value = value