-
Notifications
You must be signed in to change notification settings - Fork 166
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
Integrate hotswap support from the Hotswap Agent plugin #19261
Comments
Acceptance Criteria:
Let's not pick these changes to older maintained Vaadin branches. If this feature will be needed for older Vaadin versions or requested by Customers, let's do it, otherwise ignore it for now and let |
Currently, Vaadin hotswap plugin reacts on Vaadin plugin tries to batch file change events, instead of executing the logic immediately. I wonder if this could be applied to the other events as well. So a common interface that should be implemented by Flow and Hilla (and in the future potentially also other parts of the platform) could be something like public interface VaadinHotSwapper {
default void onClassFileEvent(VaadinService vaadinService,
Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses,
Set<Class<?>> removedClasses) {
}
default void onClassFileEvent(VaadinSession session,
Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses,
Set<Class<?>> removedClasses) {
}
default void onClassLoadEvent(VaadinService vaadinService,
boolean redefined, Set<Class<?>> classes) {
}
default void onClassLoadEvent(VaadinSession vaadinSession,
boolean redefined, Set<Class<?>> classes) {
}
default void onResourceFileEvent(VaadinService vaadinService,
Set<URI> addedResources, Set<URI> modifiedResources,
Set<URI> removedResources) {
}
default void onResourceFileEvent(VaadinSession vaadinSession,
Set<URI> addedResources, Set<URI> modifiedResources,
Set<URI> removedResources) {
}
} I also added to the interface a method to react to On the Flow side, there will be a |
Why is it that OnClassFileEvent is used? Isn't that what often leads to race conditions as you do not know when the file has been compiled and is available on the classpath? |
When you edit the UI, I wonder if it isn't more important to get the changes in the browser as quickly as possible? I am not sure when you would edit multiple files at once. In any case, the batching should be done in Vaadin then and not in the caller, so we can change it later on if needed |
I don't know the reason. We should perhaps ask the guy who pushed this commit 😉 Anyway, I think you are right on the potential issues with the file events. So it would probably make sense to only react on That said, we can most likely also drop the About batching, probably the reason was that with file events you can get different events for the same file (e,g, |
Part of #19261 Co-authored-by: Teppo Kurki <[email protected]>
Updates the Vaadin plugin to delegate reload operations to the Vaadin Hotswapper component introduced in 24.5. Backward compatibility with older Vaadin versions is preserved by detecting the absence of the Hotswapper component and falling back to the original behavior. Part of vaadin/flow#19261
* feat: add a common API to intergrate with hotswap tools Adds API to integrate with hotswap agents and to allow plugging class change reload plugins. The hotswapper also tries to refresh the views instead of reloading the page, if PUSH feature is enabled. Part of #19261 Part of #19262 * don't refresh is navigation has not yet happened * apply review suggestions * ignore events after VaadinService is destroyed * Update flow-server/src/main/java/com/vaadin/flow/router/internal/RouteRegistryHotswapper.java --------- Co-authored-by: Mikhail Shabarov <[email protected]>
Updates the Vaadin plugin to delegate reload operations to the Vaadin Hotswapper component introduced in 24.5. Backward compatibility with older Vaadin versions is preserved by detecting the absence of the Hotswapper component and falling back to the original behavior. Part of vaadin/flow#19261
Implements Flow hotswap API and removes the hotswap agent plugin. Part of vaadin/flow#19261
Describe your motivation
The Hotswap agent plugin at https://github.com/HotswapProjects/HotswapAgent/tree/master/plugin/hotswap-agent-vaadin-plugin implements support for hot reloading of various parts of Flow but it has the issue that it tries to support all Flow versions at the same time, and that it is an external project so it is always lagging behind when Flow gets new features. As it tries to support many Flow versions, the code becomes quite complex.
Describe the solution you'd like
Implement the same approach already tested in Hilla here https://github.com/vaadin/hilla/blob/main/packages/java/endpoint/src/main/java/com/vaadin/hilla/Hotswapper.java#L34 and here https://github.com/vaadin/hilla/blob/main/packages/java/hilla-dev/src/main/java/com/vaadin/hilla/devmode/hotswapagent/HillaPlugin.java
In other words, make the Hotswap Agent plugin call a Flow method when hotswapping has taken place without doing any filtering or trying to figure out what needs to be done. Let the
onHotswap
method in Flow decide what needs to be done due to reloading of the given class(es).This would have many benefits:
onHotswap
and different Flow versions can implement the method in different waysonHotswap
will become much simpler than what is in the hotswap agent pluginThe text was updated successfully, but these errors were encountered: