Replies: 3 comments 12 replies
-
I'm not entirely sure about what's the problem and what it is you want to archive. But maybe https://github.com/zauberzeug/nicegui/wiki/FAQs#why-is-my-long-running-function-blocking-ui-updates helps? |
Beta Was this translation helpful? Give feedback.
8 replies
-
How about using from nicegui import ui, events
import asyncio
async def on_update_button_click(e: events.UploadEventArguments):
e.sender.visible = False
await validate_aci_input()
ui.open("/task-list")
async def validate_aci_input():
await asyncio.sleep(5)
@ui.page("/")
def root():
upload = ui.upload(
label="Upload Data Model",
auto_upload=True,
multiple=False,
max_files=1,
max_file_size=10_000_000,
on_rejected=lambda: ui.notify("File must a zip, tar or gzip file smaller than 10Mb !"),
on_upload=lambda e: on_update_button_click(e),
).props('accept=".gz,.zip,.tar"')
ui.spinner(size="xl").bind_visibility_from(upload, "visible", lambda x: not x)
@ui.page("/task-list")
def task_list():
ui.label("task-list")
ui.run() |
Beta Was this translation helpful? Give feedback.
4 replies
-
This might be solvable with #2410. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
The issue is once the user uploads the file and clicks the submit button nothing happens for 10-12 seconds. Then suddenly they are redirected to the task list page. This isn't the best user experience as they don't even know if the button has been clicked or the background process is actually happening.
Instead I am trying to redirect the user to the 'task-list' page first and then run the background process, but it still runs validate input function before redirecting user to the other page (code below).
Then I am running this code
Beta Was this translation helpful? Give feedback.
All reactions