-
Notifications
You must be signed in to change notification settings - Fork 175
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
No endpoints.ts generated for @BrowserCallable to be used in ReactAdapterComponent/ReactAdapterElement #20289
Comments
While this is a bug and, moreover, a regression in 24.5 comparing to 24.4, I'm curious how have you noticed this bug? Have you moved your ReactAdapterElement extensions outside of src/main/frontend/views folder? Because this issue #20290 basically prevents this to happen if you use standard views folder. |
I had just created a src/main/frontend/views/HelloReact.tsx to try copilot, and checked that in. At the same time a was working on ReactAdapterElement with @BrowserCallable use. The team reported slow Flow development because of #20290. When I removed the only file in views folder HelloReact.tsx, my ReactAdapterElement stopped working because of missing endpoints. ReactAdapterElement is not in the view folder: "All routes is defined in Flow @route" |
Just to be clear: I would like @BrowserCallable/@endpoint also without the views folder (routing/hilla). It is multiple ways to communicate with backend for ReactAdapterElement (hooks.useState, hooks.useCustomEvent,@ClientCallable, props/attributes). Some need manual serialization and/or manual interface creation. I find @BrowserCallable/endpoints as the best way for @service operation. It is also reusable for other part of the code without any extra communication to the backend and wrappers to services. |
BrowserCallable is a Hilla feature and having it generated outside of routing would probably need some changes on that side. |
Yes, it is many ways to communicate - but BrowserCallable is the one that generates interface and callbacks. For refactoring and easy use: @BrowserCallable is the one! I am curious of why it is bound to the routing? I have used @endpoint since it came in Fusion, never with any frontend routing. I am fan of ReactAdapterElement an will have routing backend for simplicity - as the default. |
It's not a regression, my bad. The expected Vaadin's behaviour in this case should be, in my opinion, that the compilation of a new custom dev bundle (and custom prod bundle as well) starts once you add the All the Hilla dependencies are not needed in this case, but just what is needed for endpoints. We have to investigate the effort and our priorities for this. Even if we aren't leaning towards this enhancement, we need to mention this case in our docs. |
I understand that there will be some challenges when Hilla and Flow are merged. I think that frontend modules should be fairly independent and consist of components, translations, endpoints, interfaces, and auto-routing. If Vaadin detects React code in frontend/views or within ReactAdapterComponent, a Node module for translation is installed. If @FrontendInterface is detected, a generator is installed, and for @BrowserCallable, an addition to @FrontendInterface is installed. If there are files in frontend/views, handling of frontend routing is installed. I find the Kinder Surprise ReactAdapterComponent very useful. I am rewriting an application from React to Flow, with some components remaining in React. The routing will be handled by a thin ReactAdapterComponent, with the majority of the React code in the ReactAdapterElement. In some cases, ReactAdapterElement can be thin, with most of the UI implemented in ReactAdapterComponent. We have another React application that we might rewrite, where we may begin by setting up routing in frontend/views and using @BrowserCallable. Over time, we may rewrite it step-by-step to Flow, incorporating ReactAdapterComponent. The advantage is that I can make this decision along the way, as Vaadin can support all these hybrid situations. |
Since What's missing is probably "only" that the Hilla generator is not run when creating a new frontend bundle. We already have the code for running the generator when starting the Vite dev mode and for creating a production build so it would probably be a relatively simple change to also make sure it's run when creating a bundle. |
That would be very nice, and the only missing part for me now. What about enabling Hilla if @BrowserCallable is found? I know about the magic trick adding a dummy view, but... . |
That could also be a good option as long as it can be done efficiently (which I suspect won't be a problem since those classes should already be picked up as Spring beans). |
Related issue #18800 |
I would even say this is duplicate of the older issue |
Reverted due to the changes causing test failures in Hilla. For now, the workaround of adding a dummy view should be used, and the issue will be revisited in the future. |
When revisiting this issue, #20959 should be considered. |
Description of the bug
We have 120+ Flow views currently. Currently two as ReactAdapterElement. When developing React vaadin.frontend.hotdeploy=true
For Flow development vaadin.frontend.hotdeploy=false is default because restart/reload is much faster with dev.bundle.
No main/frontend/generated/endpoints.ts is created. Not even with vaadin:build-frontend
All routes is defined in Flow @route
Expected behavior
Endpoints should be generated
Minimal reproducible example
NA
Versions
Hilla: 24.5.0
Flow: 24.5.0
Vaadin: 24.5.0
The text was updated successfully, but these errors were encountered: