hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Support Mono in addition to Flux

Open Artur- opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. Sometimes it makes more sense to use a Mono than a Flux, e.g. when you fetch one item from a DB. Mono<T> return values should be supported from endpoint methods.

Describe the solution you'd like I think we should support a Mono<T> return value from endpoints so that the browser side API is the same as when the method returns T, i.e. returns a promise for T | undefined. It will then be different from Flux but that is the whole point of having Mono in the first place

Artur- avatar Apr 29 '22 17:04 Artur-

I’m wondering if Mono<T> should translate to Promise<T> in TypeScript? 🤔

platosha avatar May 03 '22 11:05 platosha

Are you wondering if it is good or bad that it would be Promise<T>?

To me it sounds like a Mono<T> is used in an endpoint primarly/only for Java reasons and in TS you only care about the value (or a thrown exception)

Artur- avatar May 03 '22 13:05 Artur-