aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-07-09 13:54:46 +0300
committerGitHub <noreply@github.com>2020-07-09 13:54:46 +0300
commita17348081abf87cb0d42bef4ae4faac3c8fd6c72 (patch)
tree9e8197ccb448cf7ae97137cdf94bb936ac173f91 /client/src
parentd1e6c704fd25a426d5956e521b0903910d7cb4cb (diff)
downloadvaadin-framework-a17348081abf87cb0d42bef4ae4faac3c8fd6c72.tar.gz
vaadin-framework-a17348081abf87cb0d42bef4ae4faac3c8fd6c72.zip
Revert 'Rewrote debouncing of onResize (#11899)' (#12051)
Fixes #12049
Diffstat (limited to 'client/src')
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java48
1 files changed, 15 insertions, 33 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index 9f36864bc8..1226920bd1 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -4387,9 +4387,6 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
private boolean refreshBodyRequested = false;
- private boolean resizeRequested = false;
- private boolean resizeRefreshScheduled = false;
-
private DragAndDropHandler.DragAndDropCallback headerCellDndCallback = new DragAndDropCallback() {
private final AutoScrollerCallback autoScrollerCallback = new AutoScrollerCallback() {
@@ -9325,38 +9322,23 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
/*
* Delay calculation to be deferred so Escalator can do it's magic.
*/
- resizeRequested = true;
- if (!resizeRefreshScheduled) {
- resizeRefreshScheduled = true;
- Scheduler.get().scheduleFixedDelay(() -> {
- if (!resizeRequested) {
- doRefreshOnResize();
- resizeRefreshScheduled = false;
- return false;
- } else {
- resizeRequested = false;
- return true;
- }
- }, 50);
- }
- }
-
- private void doRefreshOnResize() {
- if (escalator
- .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) {
- recalculateColumnWidths();
- }
+ Scheduler.get().scheduleFinally(() -> {
+ if (escalator
+ .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) {
+ recalculateColumnWidths();
+ }
- // Vertical resizing could make editor positioning invalid so it
- // needs to be recalculated on resize
- if (isEditorActive()) {
- editor.updateVerticalScrollPosition();
- }
+ // Vertical resizing could make editor positioning invalid so it
+ // needs to be recalculated on resize
+ if (isEditorActive()) {
+ editor.updateVerticalScrollPosition();
+ }
- // if there is a resize, we need to refresh the body to avoid an
- // off-by-one error which occurs when the user scrolls all the
- // way to the bottom.
- refreshBody();
+ // if there is a resize, we need to refresh the body to avoid an
+ // off-by-one error which occurs when the user scrolls all the
+ // way to the bottom.
+ refreshBody();
+ });
}
private double getEscalatorInnerHeight() {