= _RenderContext.render
_original_render
def pre_render(self, element: Element, container: widgets.Widget = None):
print(f'state::{self.state_get()}\n')
print(f'element: {element.component} --- {element.component.name}, {element.component.value_name}, {element.component.widget}\n')
if container is not None:
print(f'model_id::{container.model_id}')
def _patched_render(self, element: Element, container: widgets.Widget = None):
self, element, container)
pre_render(
self, element, container)
_original_render(
= _patched_render # type: ignore _RenderContext.render
Reacton
Adding a pre_render
hook to reacton codebase we’re able to track each state change at component level.
Testing
The following cells displays ipywidgets an solara example of monitoring state changes. Interact with the following widgets to intercept its state changes.
= solara.reactive(0)
int_value = solara.SliderInt("Another Test Slider:", value=int_value, min=0, max=10) slider