Closed Ezbaze closed 9 months ago
Hi @Ezbaze,
I'm not 100% sure why your code doesn't work as expected. I think it has to do with the way @refreshable
keeps track of the current instance that needs to be refreshed when calling refresh()
. By holding a reference _ui
to Test().ui
, this mechanism fails.
It's better to keep a reference to the Test
instance:
class Test:
@ui.refreshable
def ui(self, name):
ui.notify(f"Refreshing {name}")
@ui.page("/")
def page_layout():
test = Test()
ui.input("INPUT", on_change=lambda event: test.ui.refresh(event.value))
test.ui("START")
Hi @falkoschindler ,
I didnt think of that, but that does solve the issue I was facing :)
Thank you
Description
https://github.com/zauberzeug/nicegui/assets/68749104/38f8049c-b509-4195-9360-c2b4f4c2eae8
Additional notes:
Thank you