From 73e5824e35534afa08a65db60203f643c03eca6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Thu, 30 Aug 2018 11:13:04 -0700 Subject: [PATCH] ManagedTable debouncing Summary: Removes the fix introduced in D9570518 and upgrading to `react-window@1.1.2` which fixes the problem in the library. Also finetuning debounce times. Reviewed By: passy Differential Revision: D9582591 fbshipit-source-id: 92b008d29f96ce0f11f5cfb5d9e92175ae536ee2 --- src/ui/components/table/ManagedTable.js | 13 ++----------- yarn.lock | 6 ++++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/ui/components/table/ManagedTable.js b/src/ui/components/table/ManagedTable.js index f45993912..62ad8bdd0 100644 --- a/src/ui/components/table/ManagedTable.js +++ b/src/ui/components/table/ManagedTable.js @@ -273,17 +273,8 @@ class ManagedTable extends React.Component< scrollToBottom() { const {current: tableRef} = this.tableRef; - const {current: scrollRef} = this.scrollRef; - if (!tableRef || !scrollRef) { - return; - } - // only call scrollToItem if the list is actually scrollable (height of the - // content is bigger than it's container). Otherwise this might cause - // problems: https://github.com/bvaughn/react-window/issues/49 - const isScrollable = tableRef.props.height < scrollRef.offsetHeight; - - if (tableRef && this.props.rows.length > 1 && isScrollable) { + if (tableRef && this.props.rows.length > 1) { tableRef.scrollToItem(this.props.rows.length - 1); } } @@ -531,4 +522,4 @@ class ManagedTable extends React.Component< } } -export default debounceRender(ManagedTable, 150, {maxTime: 200}); +export default debounceRender(ManagedTable, 150, {maxWait: 250}); diff --git a/yarn.lock b/yarn.lock index 7fc01e557..eaf7a84e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3476,6 +3476,7 @@ mem@^1.1.0: memoize-one@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-3.1.1.tgz#ef609811e3bc28970eac2884eece64d167830d17" + integrity sha512-YqVh744GsMlZu6xkhGslPSqSurOv6P+kLN2J3ysBZfagLcL5FdRK/0UpgLoL8hwjjEvvAVkjJZyFP+1T6p1vgA== meow@^3.1.0: version "3.7.0" @@ -4258,8 +4259,9 @@ react-virtualized-auto-sizer@^1.0.2: resolved "https://registry.yarnpkg.com/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.2.tgz#a61dd4f756458bbf63bd895a92379f9b70f803bd" react-window@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/react-window/-/react-window-1.1.1.tgz#8a0cf488c9db19425fb804f118f5aac6227d7fd2" + version "1.1.2" + resolved "https://registry.yarnpkg.com/react-window/-/react-window-1.1.2.tgz#1909e5e9bc0158531c18044b1f06ad91b11291e8" + integrity sha512-7cHSreVnLHds09devYhtt7sTVKX7IEibXo8Mn9JRbOAFNCqj10HfuIzNCP2P+NVX8+DnXr/tp9AbdTaTZ7wcbA== dependencies: memoize-one "^3.1.1"