From c0fdd1191c2908d30b71bc1ad5009d35a3ca6a4b Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 20 Jun 2017 15:55:49 +0300 Subject: Prevent multiple runs of hierarchy column update (#9561) Fixes #9555 --- .../com/vaadin/client/ui/treegrid/TreeGridConnector.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java index 48ba0562fd..c50da18e53 100644 --- a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java @@ -77,6 +77,8 @@ public class TreeGridConnector extends GridConnector { private AwaitingRowsState awaitingRowsState = AwaitingRowsState.NONE; + private boolean hierarchyColumnUpdateScheduled = false; + @Override public TreeGrid getWidget() { return (TreeGrid) super.getWidget(); @@ -92,13 +94,16 @@ public class TreeGridConnector extends GridConnector { * between state change handling for the Grid and its columns. The renderer * of the column is set in a state change handler, and might not be * available when this method is executed. - *

- * TODO: This might need some clean up if we decide to allow setting a new - * renderer for hierarchy columns. */ @OnStateChange("hierarchyColumnId") void updateHierarchyColumn() { + if (hierarchyColumnUpdateScheduled) { + return; + } + Scheduler.get().scheduleFinally(() -> { + hierarchyColumnUpdateScheduled = false; + // Id of old hierarchy column String oldHierarchyColumnId = hierarchyColumnId; @@ -143,6 +148,7 @@ public class TreeGridConnector extends GridConnector { "Couldn't find column: " + newHierarchyColumnId); } }); + hierarchyColumnUpdateScheduled = true; } private HierarchyRenderer getHierarchyRenderer() { -- cgit v1.2.3