Skip to content

Commit

Permalink
chore: bump Vaadin to 24.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollovati committed Dec 22, 2024
1 parent ba83677 commit 0edd02d
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 15 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
<spotless-maven-plugin.version>2.41.1</spotless-maven-plugin.version>

<vertx.version>4.5.9</vertx.version>
<vaadin.platform.version>24.4.10</vaadin.platform.version>
<vaadin.flow.version>24.4.6</vaadin.flow.version>
<hilla.version>24.4.6</hilla.version>
<vaadin.platform.version>24.5.9</vaadin.platform.version>
<vaadin.flow.version>24.5.10</vaadin.flow.version>
<hilla.version>24.5.9</hilla.version>

<jakarta.servlet.version>6.0.0</jakarta.servlet.version>
<byte-buddy.version>1.14.11</byte-buddy.version>
Expand Down
2 changes: 1 addition & 1 deletion vertx-vaadin-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<checkstyle.skip>false</checkstyle.skip>
<classgraph.version>4.8.157</classgraph.version>
<vaadin-flow-sockjs.version>${project.version}</vaadin-flow-sockjs.version>
<jackson.version>2.14.2</jackson.version>
<jackson.version>2.17.2</jackson.version>
<javax.annotation.api.version>1.3.2</javax.annotation.api.version>
<jakarta.websocket.version>2.1.1</jakarta.websocket.version>
<validation.api.version>3.0.2</validation.api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.github.mcollovati.vertx.vaadin.communication.VertxDebugWindowConnection;
import com.github.mcollovati.vertx.vaadin.sockjs.communication.VertxVaadinLiveReload;

import elemental.json.JsonObject;

class VertxVaadinBrowserLiveReload implements BrowserLiveReload {

private final BrowserLiveReload delegate;
Expand Down Expand Up @@ -77,6 +79,11 @@ public void update(String path, String content) {
reloader.update(path, content);
}

@Override
public void sendHmrEvent(String event, JsonObject eventData) {
reloader.sendHmrEvent(event, eventData);
}

@Override
public void reload() {
reloader.reload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import com.vaadin.base.devserver.stats.DevModeUsageStatistics;
import com.vaadin.experimental.FeatureFlags;
import com.vaadin.flow.server.VaadinContext;
import com.vaadin.flow.server.startup.ApplicationConfiguration;
import com.vaadin.pro.licensechecker.BuildType;
import com.vaadin.pro.licensechecker.LicenseChecker;
import com.vaadin.pro.licensechecker.Product;
Expand Down Expand Up @@ -152,18 +151,32 @@ public void onMessage(String websocketId, String message) {
}
}

private void send(String websocketId, String command, Object data) {
public void sendHmrEvent(String event, JsonObject eventData) {
JsonObject msg = elemental.json.Json.createObject();
msg.put("command", "hmr");
JsonObject data = elemental.json.Json.createObject();
msg.put("data", data);
data.put("event", event);
data.put("eventData", eventData);
broadcast(msg);
}

private void send(String websocketId, String command,
Object data) {
send(websocketId, Json.encode(new DebugWindowMessage(command, data)));
}

private void send(String websocketId, String json) {
try {
Optional.ofNullable(liveReload.get(websocketId))
.ifPresent(producer -> producer.accept(Json.encode(new DebugWindowMessage(command, data))));
.ifPresent(producer -> producer.accept(json));
} catch (Exception e) {
getLogger().error("Error sending message", e);
}
}

public void onClose(String websocketId) {
logger.debug("Live reload connection disconnected for {}", websocketId);
// Optional.ofNullable(liveReload.get(websocketId)).ifPresent(MessageProducer::close);
for (DevToolsMessageHandler plugin : plugins) {
plugin.handleDisconnect(getDevToolsInterface(websocketId));
}
Expand All @@ -175,16 +188,16 @@ public void update(String path, String content) {
msg.put("command", "update");
msg.put("path", path);
msg.put("content", content);
sendToAll(msg);
broadcast(msg);
}

public void reload() {
JsonObject msg = elemental.json.Json.createObject();
msg.put("command", "reload");
sendToAll(msg);
broadcast(msg);
}

private void sendToAll(JsonObject message) {
private void broadcast(JsonObject message) {
String json = message.toJson();
liveReload.values().stream().filter(Objects::nonNull).forEach(socket -> socket.accept(json));
}
Expand Down Expand Up @@ -223,7 +236,12 @@ public DevToolsInterfaceImpl(VertxDebugWindowConnection connection, String webso

@Override
public void send(String command, JsonObject data) {
connection.send(websocketId, command, data);
JsonObject msg = elemental.json.Json.createObject();
msg.put("command", command);
if (data != null) {
msg.put("data", data);
}
connection.send(websocketId, msg.toJson());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/
package com.github.mcollovati.vertx.vaadin.sockjs.communication;

import elemental.json.JsonObject;

/**
* Provides a way to reload browser tabs via web socket connection.
*/
Expand All @@ -42,4 +44,14 @@ public interface VertxVaadinLiveReload {
*/
void update(String path, String content);

/**
* Send a client side HMR event.
*
* @param event
* the event name
* @param eventData
* the event data
*/
void sendHmrEvent(String event, JsonObject eventData);

}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void uiInitEventObserved() throws IOException {
}

private void assertSystemMessageEquals(String expected) {
WebElement message = findElement(By.cssSelector("div.v-system-error div.message"));
WebElement message = waitUntil(d -> findElement(By.cssSelector("div.v-system-error div.message")));
Assertions.assertEquals(expected, message.getText());
}
}
4 changes: 2 additions & 2 deletions vertx-vaadin-quarkus-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<failsafe.useModulePath>false</failsafe.useModulePath>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.8.6</quarkus.version>
<quarkus.version>3.12.2</quarkus.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<failsafe-plugin.version>${surefire-plugin.version}</failsafe-plugin.version>
</properties>
Expand Down

0 comments on commit 0edd02d

Please sign in to comment.