summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-05-02 18:57:33 +0300
committerHenri Sara <henri.sara@gmail.com>2017-05-02 18:57:33 +0300
commita1c2b2f6764e51acdab16a8cd3234fba1d688005 (patch)
tree518cb87e1701d6cf9bffb6bcfd415ade89f936e7
parentbb43a537e05d9d60ef82f1acac41cea6343c8cbb (diff)
downloadvaadin-framework-a1c2b2f6764e51acdab16a8cd3234fba1d688005.tar.gz
vaadin-framework-a1c2b2f6764e51acdab16a8cd3234fba1d688005.zip
HierarchicalDataProvider cache invalidation workaround (#9218)
Workaround for issue in data communication where active keys are dropped incorrectly on the server. See issue #9217
-rw-r--r--server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridClientSortTest.java32
2 files changed, 35 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java
index 5761b65d35..820e3d8f2c 100644
--- a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java
+++ b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java
@@ -288,7 +288,9 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> {
String itemKey = keys.getString(i);
if (!mapper.isKeyStored(itemKey)
&& !rowKeysPendingExpand.contains(itemKey)) {
- getActiveDataHandler().dropActiveData(itemKey);
+ // FIXME: cache invalidated incorrectly, active keys being
+ // dropped prematurely
+ // getActiveDataHandler().dropActiveData(itemKey);
}
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridClientSortTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridClientSortTest.java
new file mode 100644
index 0000000000..2000d1388b
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridClientSortTest.java
@@ -0,0 +1,32 @@
+package com.vaadin.tests.components.treegrid;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TreeGridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class TreeGridClientSortTest extends SingleBrowserTest {
+
+ @Override
+ public Class<?> getUIClass() {
+ return TreeGridBasicFeatures.class;
+ }
+
+ @Test
+ public void client_sorting_with_collapse_and_expand() {
+ openTestURL();
+ TreeGridElement grid = $(TreeGridElement.class).first();
+ selectMenuPath("Component", "Features", "Set data provider",
+ "InMemoryHierarchicalDataProvider");
+ grid.getHeaderCell(0, 0).doubleClick();
+ grid.expandWithClick(0);
+ grid.expandWithClick(1);
+ grid.collapseWithClick(0);
+ grid.expandWithClick(0);
+ assertEquals("0 | 2", grid.getCell(0, 0).getText());
+ assertEquals("1 | 2", grid.getCell(1, 0).getText());
+ assertEquals("2 | 2", grid.getCell(2, 0).getText());
+ }
+}