vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
617 stars 167 forks source link

No endpoints.ts generated for @BrowserCallable to be used in ReactAdapterComponent/ReactAdapterElement #20289

Open sveinnetnordic opened 3 days ago

sveinnetnordic commented 3 days ago

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

mshabarov commented 2 days ago

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 https://github.com/vaadin/flow/issues/20290 basically prevents this to happen if you use standard views folder.

sveinnetnordic commented 2 days ago

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 https://github.com/vaadin/flow/issues/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"

sveinnetnordic commented 17 hours ago

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.