-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
log.push() not working #288
Comments
The Because we had applications in mind, where only the most recent messages are of any use, we decided not to hold any state in Python but only in JavaScript on the client side. So if a client connects, the log is empty at first and gets filled line by line as new messages get pushed into the log. In your example a new log is created. And before it gets transmitted to the client, multiple lines are pushed. But since the element did not reach the client yet, the lines get lost. We should probably rethink this design. We could easily keep a copy of the last |
I actually found a workaround: import asyncio
from nicegui import ui
async def process():
with ui_container:
ui.label("Begin process...")
log = ui.log()
await asyncio.sleep(0.01) # This actually waits for the log to be created
for i in range(10):
log.push(f"process {i}") # So this works now
ui.label("End process")
ui.label('Testing process')
ui.button("Process", on_click=process).props('icon=start')
ui_container = ui.column()
ui.run() |
I created PR #292 to improve |
I just merged your branch! |
I don't understand why log.push() is not working:
After pressing the button, the labels are shown before and after, and the log is shown. But the log entries are not.
The text was updated successfully, but these errors were encountered: