-
-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui.codemirror
not updating when the bound dictionary changes
#3337
Comments
It is a little similar to #3217 . Following code shows that from nicegui import ui
shared_memory = {
'code': '',
'design': '',
'test': '',
}
@ui.page('/')
def main():
editor = ui.codemirror(language='python').bind_value(shared_memory, 'code')
ui.markdown(shared_memory["code"]).bind_content(shared_memory, 'code')
ui.button('clear code').on('click', lambda: shared_memory.update(code=''))
ui.button('print',on_click=lambda :ui.notify(editor._props['value']))
ui.run() |
It turned out that fixing Minimum reproduction: code = ui.codemirror(value='foo')
ui.label().bind_text_from(code, 'value')
ui.button('Set X', on_click=lambda: code.set_value('X')) The button only works once. Somehow we need a similar solution like PR #3346, but combined with the already existing Vue component in codemirror.js. |
ui.codemirror
not updating when the bound dictionary changes
Description
Using
nicegui==1.4.28
When the button is clicked the first time, it works as expected. Both the markdown text and the codemirror editor are cleared.
However, when it's clicked the second time, the markdown gets cleared while the codemirror remains the same.
When I try to edit what's in codemirror, I get the following error.
The text was updated successfully, but these errors were encountered: