UI Multitasking

How do i let the user to input data in a form while the ui is still loading other parts of the page.I m building an order item entry form. The user selects the article name from dropdown and inputs the quantity and click enter. Also i need to load and show the order history to that article on UI but loading of item history can take up some time which will make UI stuck and user unable to add new item. Although i am loading item history inside ui.access but still ui show loading bar and makes user unable to input more data.

You need to have @Push annotation in AppShellConfigurator to enable Push.

I do have added @push annotation and it seems to work fine as the item history is pushed to UI but only issue is UI becomes unusable while that push happens

It sounds like you need to make sure the UI request thread completes as quickly as possible. Hard to say anything more without the specifics of your code, but essentially any slow operation that occurs after a user interaction (such as from a click listener) should be executed in a background thread.

And you should certainly not do anything slow inside ui.access

True. You enable pushes, you run your query asynchronously and only invoke ui.access to set the result to the UI. As long as ui.access is occupied by non-ui Thread, UI is frozen awaiting for it.

Here’s an example of accessing the UI from a separate thread. Basically, an action does some work and sets the card loading (debouncing at 2 seconds), but the UI is still accessible: https://codeberg.org/sunshower/stratosphere/src/branch/main/stratosphere/src/main/java/io/sunshower/stratosphere/ui/components/Card.java

demo-2.gif

Here it is in action

Thanks for all the suggestions. It’s really helpful