hilla
hilla copied to clipboard
Add way to disable/configure progress indicator
Describe your motivation
I'm already displaying progress on a component level for long-running endpoint calls. The app UX is deteriorated by the app-level progress indicator flashing during these operations.
Describe the solution you'd like
I would like a way to configure or disable the progress indicator when I'm already handling progress indication myself.
Describe alternatives you've considered
Hiding it with CSS
Additional context
As always, @TatuLund has a workaround https://vaadin.com/forum/t/how-do-i-disable-the-hilla-loading-indicator/166223/3 :)
I would spontaneously think of two different approaches for this feature: based on the called method or based on the invocation.
If it's based on the method, then the indicator would never be shown for a specific method and you would thus have to expose multiple methods if you sometimes want to show the indicator and sometimes not.
@BrowserCallable
public class HelloService {
@BackgroundTask
public String sayHelloWithoutProgressIndicator(String name) {
return "Hello " + name
}
public String sayHelloWithProgressInidicator(String name) {
return "Hello " + name
}
}
If it's based on the invocation, then we could overload the optional EndpointRequestInit parameter that is already there for the abort signal. This does instead add some boilerplate to every invocation (unless you curry it).
const greeting = await HelloService.sayHello(name, {showProgress: false});
Any insights on which way would be preferable?
Regardless of the annotation on the Java method, I would like to have the option to disable it on a per-call basis (the latter example). It's also more explicit to make you consider that you're actually indicating progress in some other way, whereas it would be easy to end up in a situation where one developer adds the backend annotation and another uses it in the frontend without noticing that and the UX suffers.