You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/05/14 07:58:26 UTC
(camel) 05/10: CAMEL-23514: Fix diagram flicker during live metric refresh
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-23514-ascii-diagram-metrics
in repository https://gitbox.apache.org/repos/asf/camel.git
commit d65865149e78d2a22f756d623f483dd2976f97bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:36:03 2026 +0200
CAMEL-23514: Fix diagram flicker during live metric refresh
Only show the "Loading diagram..." state on initial load, not on
tick-based refreshes. Preserve scroll position when refreshing an
already-visible diagram. This prevents the visible flash between
the loading placeholder and the actual diagram content on each tick.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 33 +++++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
index 58129fe37824..8f757e129554 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
@@ -1261,14 +1261,16 @@ public class CamelMonitor extends CamelCommand {
boolean showMetrics = diagramMetrics;
String routeId = selectedRoute.routeId;
- // Show loading state immediately
- diagramRouteId = routeId;
- diagramLines = List.of("(Loading diagram...)");
- diagramImageData = null;
- diagramFullImageData = null;
- showDiagram = true;
- diagramScroll = 0;
- diagramScrollX = 0;
+ boolean initialLoad = !showDiagram;
+ if (initialLoad) {
+ diagramRouteId = routeId;
+ diagramLines = List.of("(Loading diagram...)");
+ diagramImageData = null;
+ diagramFullImageData = null;
+ showDiagram = true;
+ diagramScroll = 0;
+ diagramScrollX = 0;
+ }
runner.scheduler().execute(() -> {
try {
@@ -1377,17 +1379,20 @@ public class CamelMonitor extends CamelCommand {
return;
}
runner.runOnRenderThread(() -> {
+ boolean wasShowing = showDiagram;
diagramRouteId = routeId;
diagramLines = lines;
diagramImageData = imageData;
diagramFullImageData = fullImageData;
diagramProtocol = protocol;
- diagramScroll = 0;
- diagramScrollX = 0;
- diagramCropX = -1;
- diagramCropY = -1;
- diagramCropW = -1;
- diagramCropH = -1;
+ if (!wasShowing) {
+ diagramScroll = 0;
+ diagramScrollX = 0;
+ diagramCropX = -1;
+ diagramCropY = -1;
+ diagramCropW = -1;
+ diagramCropH = -1;
+ }
showDiagram = true;
});
}