From 904e300d88fe93a8400d7e2f3eaf7794eda69e69 Mon Sep 17 00:00:00 2001 From: sudheer Date: Tue, 23 Apr 2019 00:24:10 +0530 Subject: [PATCH 1/6] MM-14949 Correct scroll when new posts are loaded * Check for state change in posts instead of props * Correct scroll when posts change at top or when header changes * use snapshot for taking height before updating postslist --- components/post_view/post_list.jsx | 62 +++++++++++++++++--- components/post_view/post_list.test.jsx | 30 ++++++++++ components/post_view/show_more/show_more.jsx | 28 +++++---- package-lock.json | 4 +- package.json | 2 +- sass/layout/_post.scss | 14 +---- 6 files changed, 108 insertions(+), 32 deletions(-) diff --git a/components/post_view/post_list.jsx b/components/post_view/post_list.jsx index 09214ce68287..512041e1f999 100644 --- a/components/post_view/post_list.jsx +++ b/components/post_view/post_list.jsx @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import {DynamicSizeList} from 'react-window'; +import {debounce} from 'mattermost-redux/actions/helpers'; import LoadingScreen from 'components/loading_screen.jsx'; @@ -25,6 +26,18 @@ const OVERSCAN_COUNT_BACKWARD = window.OVERSCAN_COUNT_BACKWARD || 50; // Exposin const OVERSCAN_COUNT_FORWARD = window.OVERSCAN_COUNT_FORWARD || 100; // Exposing the value for PM to test will be removed soon const HEIGHT_TRIGGER_FOR_MORE_POSTS = window.HEIGHT_TRIGGER_FOR_MORE_POSTS || 1000; // Exposing the value for PM to test will be removed soon +const postListHeightChangeForPadding = 21; + +const virtListStyles = { + position: 'absolute', + bottom: '0', + maxHeight: '100%', +}; + +const postListStyle = { + padding: '14px 0px 7px', //21px of height difference from autosized list below at DynamicSizeList height change postListHeightChangeForPadding accordingly +}; + export default class PostList extends React.PureComponent { static propTypes = { @@ -101,6 +114,7 @@ export default class PostList extends React.PureComponent { }; this.listRef = React.createRef(); + this.postlistRef = React.createRef(); if (isMobile) { this.scrollStopAction = new DelayedAction(this.handleScrollStop); } @@ -116,10 +130,41 @@ export default class PostList extends React.PureComponent { window.addEventListener('resize', this.handleWindowResize); } - componentDidUpdate(prevProps) { + getSnapshotBeforeUpdate(prevProps, prevState) { + if (this.postlistRef && this.postlistRef.current) { + const postsAddedAtTop = this.state.postListIds.length !== prevState.postListIds.length && this.state.postListIds[0] === prevState.postListIds[0]; + const channelHeaderAdded = this.state.atEnd !== prevState.atEnd && this.state.postListIds.length === prevState.postListIds.length; + if (postsAddedAtTop || channelHeaderAdded) { + const previousScrollTop = this.postlistRef.current.scrollTop; + const previousScrollHeight = this.postlistRef.current.scrollHeight; + + return { + previousScrollTop, + previousScrollHeight, + }; + } + } + return null; + } + + componentDidUpdate(prevProps, prevState, snapshot) { if (prevProps.channelLoading && !this.props.channelLoading) { this.loadPosts(this.props.channel.id, this.props.focusedPostId); } + + if (!this.postlistRef.current || !snapshot) { + return; + } + + const postlistScrollHeight = this.postlistRef.current.scrollHeight; + const postsAddedAtTop = this.state.postListIds.length !== prevState.postListIds.length && this.state.postListIds[0] === prevState.postListIds[0]; + const channelHeaderAdded = this.state.atEnd !== prevState.atEnd && this.state.postListIds.length === prevState.postListIds.length; + if (postsAddedAtTop || channelHeaderAdded) { + const scrollValue = snapshot.previousScrollTop + (postlistScrollHeight - snapshot.previousScrollHeight); + if (scrollValue !== 0 && (scrollValue - snapshot.previousScrollTop) !== 0) { + this.listRef.current.scrollTo(scrollValue, scrollValue - snapshot.previousScrollTop, !this.state.atEnd); + } + } } componentWillUnmount() { @@ -196,7 +241,9 @@ export default class PostList extends React.PureComponent { if (error) { if (this.autoRetriesCount < MAX_NUMBER_OF_AUTO_RETRIES) { this.autoRetriesCount++; - this.loadMorePosts(); + debounce(() => { + this.loadMorePosts(); + }); } else if (this.mounted) { this.setState({autoRetryEnable: false}); } @@ -317,8 +364,8 @@ export default class PostList extends React.PureComponent { visibleStartIndex, visibleStopIndex, }) => { - this.updateFloatingTimestamp(visibleStopIndex); - this.checkBottom(visibleStartIndex); + this.updateFloatingTimestamp(visibleStartIndex); + this.checkBottom(visibleStopIndex); } initScrollToIndex = () => { @@ -443,7 +490,7 @@ export default class PostList extends React.PureComponent { {({height, width}) => ( {this.renderRow} diff --git a/components/post_view/post_list.test.jsx b/components/post_view/post_list.test.jsx index ccd36dd2b0db..dab20ab07cb8 100644 --- a/components/post_view/post_list.test.jsx +++ b/components/post_view/post_list.test.jsx @@ -116,6 +116,7 @@ describe('PostList', () => { describe('initScrollToIndex', () => { test('should return index of start of new messages and call increasePostVisibility when all posts are unread', () => { + baseProps.actions.increasePostVisibility.mockResolvedValue({moreToLoad: false}); const postListIds = []; for (let i = 0; i < 30; i++) { postListIds.push(`post${i}`); @@ -152,4 +153,33 @@ describe('PostList', () => { expect(wrapper.state('atEnd')).toEqual(true); }); }); + + describe('onItemsRendered', () => { + test('should set state atBottom when not visibleStopIndex is not 0', async () => { + const wrapper = shallow(); + wrapper.setState({atBottom: true}); + wrapper.instance().onItemsRendered({visibleStartIndex: 4, visibleStopIndex: 1}); + expect(wrapper.state('atBottom')).toEqual(false); + }); + }); + + describe('store snapshot values on change of props for correcting scroll', () => { + test('Should call scrollTo when posts are added at the top', async () => { + const wrapper = shallow(); + wrapper.instance().postlistRef = { + current: { + scrollTop: 1000, + scrollHeight: 4000, + }, + }; + wrapper.setProps({postListIds: [ + 'post1', + 'post2', + 'post3', + 'post4', + DATE_LINE + 1551711600000, + ]}); + wrapper.update(); + }); + }); }); diff --git a/components/post_view/show_more/show_more.jsx b/components/post_view/show_more/show_more.jsx index 8de53a5058d8..3a04d3914647 100644 --- a/components/post_view/show_more/show_more.jsx +++ b/components/post_view/show_more/show_more.jsx @@ -41,6 +41,9 @@ export default class ShowMore extends React.PureComponent { componentWillUnmount() { window.removeEventListener('resize', this.handleResize); + if (this.overflowRef) { + window.cancelAnimationFrame(this.overflowRef); + } } toggleCollapse = (e) => { @@ -53,18 +56,23 @@ export default class ShowMore extends React.PureComponent { }; checkTextOverflow = () => { - const textContainer = this.refs.textContainer; - let isOverflow = false; - - if (textContainer && textContainer.scrollHeight > this.props.maxHeight) { - isOverflow = true; + if (this.overflowRef) { + window.cancelAnimationFrame(this.overflowRef); } + this.overflowRef = window.requestAnimationFrame(() => { + const textContainer = this.refs.textContainer; + let isOverflow = false; - if (isOverflow !== this.state.isOverflow) { - this.setState({ - isOverflow, - }); - } + if (textContainer && textContainer.scrollHeight > this.props.maxHeight) { + isOverflow = true; + } + + if (isOverflow !== this.state.isOverflow) { + this.setState({ + isOverflow, + }); + } + }); }; handleResize = () => { diff --git a/package-lock.json b/package-lock.json index ee54f3916a3b..8029a86197ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13059,8 +13059,8 @@ "integrity": "sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==" }, "react-window": { - "version": "github:mattermost/react-window#22cab3a8a0f4e3793ba778a990f1c0723b4c8129", - "from": "github:mattermost/react-window#22cab3a8a0f4e3793ba778a990f1c0723b4c8129", + "version": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", + "from": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", "requires": { "@babel/runtime": "^7.0.0", "memoize-one": "^3.1.1" diff --git a/package.json b/package.json index 93c6d7839ceb..504c2906694b 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-select": "2.4.2", "react-transition-group": "2.7.1", "react-virtualized-auto-sizer": "^1.0.2", - "react-window": "github:mattermost/react-window#22cab3a8a0f4e3793ba778a990f1c0723b4c8129", + "react-window": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", "rebound": "0.1.0", "redux": "4.0.1", "redux-batched-actions": "0.4.1", diff --git a/sass/layout/_post.scss b/sass/layout/_post.scss index c9bd90b1db70..d7ee1b117d93 100644 --- a/sass/layout/_post.scss +++ b/sass/layout/_post.scss @@ -284,7 +284,6 @@ } .post-list-holder-by-time { - -webkit-overflow-scrolling: touch; height: 100%; width: 100%; position: absolute; @@ -413,14 +412,6 @@ padding: 15px; } -.post-list__dynamic { - > div { - > div { - margin-bottom: 8px; - } - } -} - .post-create__container { @include flex(0 0 auto); width: 100%; @@ -700,13 +691,12 @@ .post-list__table { @include clearfix; - display: table; height: 100%; - table-layout: fixed; width: 100%; .post-list__content { - display: table-cell; + height: 100%; + overflow: hidden; .dropdown-menu { &.bottom { From e3fa852b9a2ff7d168b71536d7de0399840aa2bb Mon Sep 17 00:00:00 2001 From: sudheer Date: Mon, 29 Apr 2019 22:08:14 +0530 Subject: [PATCH 2/6] update window hash --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8029a86197ec..3ff104612d0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13059,8 +13059,8 @@ "integrity": "sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==" }, "react-window": { - "version": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", - "from": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", + "version": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", + "from": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", "requires": { "@babel/runtime": "^7.0.0", "memoize-one": "^3.1.1" diff --git a/package.json b/package.json index 504c2906694b..7ef801dafca8 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-select": "2.4.2", "react-transition-group": "2.7.1", "react-virtualized-auto-sizer": "^1.0.2", - "react-window": "github:mattermost/react-window#aa71079c988be134735060d890fecff1479ede2a", + "react-window": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", "rebound": "0.1.0", "redux": "4.0.1", "redux-batched-actions": "0.4.1", From 4b9e817704a33c15d4eb1effb3604674fc1a1c56 Mon Sep 17 00:00:00 2001 From: sudheer Date: Mon, 29 Apr 2019 22:42:50 +0530 Subject: [PATCH 3/6] Remove test case for snapshot --- components/post_view/post_list.test.jsx | 22 +--------------------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/components/post_view/post_list.test.jsx b/components/post_view/post_list.test.jsx index dab20ab07cb8..165d940e7d32 100644 --- a/components/post_view/post_list.test.jsx +++ b/components/post_view/post_list.test.jsx @@ -155,31 +155,11 @@ describe('PostList', () => { }); describe('onItemsRendered', () => { - test('should set state atBottom when not visibleStopIndex is not 0', async () => { + test('should set state atBottom false when visibleStopIndex is not 0', async () => { const wrapper = shallow(); wrapper.setState({atBottom: true}); wrapper.instance().onItemsRendered({visibleStartIndex: 4, visibleStopIndex: 1}); expect(wrapper.state('atBottom')).toEqual(false); }); }); - - describe('store snapshot values on change of props for correcting scroll', () => { - test('Should call scrollTo when posts are added at the top', async () => { - const wrapper = shallow(); - wrapper.instance().postlistRef = { - current: { - scrollTop: 1000, - scrollHeight: 4000, - }, - }; - wrapper.setProps({postListIds: [ - 'post1', - 'post2', - 'post3', - 'post4', - DATE_LINE + 1551711600000, - ]}); - wrapper.update(); - }); - }); }); diff --git a/package-lock.json b/package-lock.json index 3ff104612d0c..f72dd2655fc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13059,8 +13059,8 @@ "integrity": "sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==" }, "react-window": { - "version": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", - "from": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", + "version": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", + "from": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", "requires": { "@babel/runtime": "^7.0.0", "memoize-one": "^3.1.1" diff --git a/package.json b/package.json index 7ef801dafca8..d44be1d6728c 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-select": "2.4.2", "react-transition-group": "2.7.1", "react-virtualized-auto-sizer": "^1.0.2", - "react-window": "github:mattermost/react-window#0f48e06e6ee3a45559debef72d357b7aea811fc2", + "react-window": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", "rebound": "0.1.0", "redux": "4.0.1", "redux-batched-actions": "0.4.1", From eb9fde6b29605498ec2e69e96ffaa505811d5984 Mon Sep 17 00:00:00 2001 From: sudheer Date: Tue, 30 Apr 2019 13:54:45 +0530 Subject: [PATCH 4/6] * Address review comments * Downgrade enzyme --- components/post_view/post_list.jsx | 8 +++--- components/post_view/post_list.test.jsx | 32 +++++++++++++++++++++- package-lock.json | 35 +++++++------------------ package.json | 4 +-- 4 files changed, 46 insertions(+), 33 deletions(-) diff --git a/components/post_view/post_list.jsx b/components/post_view/post_list.jsx index 512041e1f999..dc6b8788764b 100644 --- a/components/post_view/post_list.jsx +++ b/components/post_view/post_list.jsx @@ -28,16 +28,16 @@ const HEIGHT_TRIGGER_FOR_MORE_POSTS = window.HEIGHT_TRIGGER_FOR_MORE_POSTS || 10 const postListHeightChangeForPadding = 21; +const postListStyle = { + padding: '14px 0px 7px', //21px of height difference from autosized list compared to DynamicSizeList. If this is changed change the above variable postListHeightChangeForPadding accordingly +}; + const virtListStyles = { position: 'absolute', bottom: '0', maxHeight: '100%', }; -const postListStyle = { - padding: '14px 0px 7px', //21px of height difference from autosized list below at DynamicSizeList height change postListHeightChangeForPadding accordingly -}; - export default class PostList extends React.PureComponent { static propTypes = { diff --git a/components/post_view/post_list.test.jsx b/components/post_view/post_list.test.jsx index 165d940e7d32..3ff1e6cbf297 100644 --- a/components/post_view/post_list.test.jsx +++ b/components/post_view/post_list.test.jsx @@ -155,11 +155,41 @@ describe('PostList', () => { }); describe('onItemsRendered', () => { - test('should set state atBottom false when visibleStopIndex is not 0', async () => { + test('should set state atBottom false when visibleStopIndex is not 0', () => { const wrapper = shallow(); wrapper.setState({atBottom: true}); wrapper.instance().onItemsRendered({visibleStartIndex: 4, visibleStopIndex: 1}); expect(wrapper.state('atBottom')).toEqual(false); }); }); + describe('Scroll correction logic on mount of posts at the top', () => { + test('should return previous scroll position from getSnapshotBeforeUpdate', () => { + const wrapper = shallow(); + const instance = wrapper.instance(); + instance.componentDidUpdate = jest.fn(); + + instance.postlistRef = {current: {scrollTop: 10, scrollHeight: 100}}; + wrapper.setState({atEnd: true}); + expect(instance.componentDidUpdate).toHaveBeenCalledTimes(1); + expect(instance.componentDidUpdate.mock.calls[0][2]).toEqual({previousScrollTop: 10, previousScrollHeight: 100}); + + instance.postlistRef = {current: {scrollTop: 30, scrollHeight: 200}}; + wrapper.setState({atEnd: false}); + expect(instance.componentDidUpdate).toHaveBeenCalledTimes(2); + expect(instance.componentDidUpdate.mock.calls[1][2]).toEqual({previousScrollTop: 30, previousScrollHeight: 200}); + + instance.postlistRef = {current: {scrollTop: 40, scrollHeight: 400}}; + wrapper.setProps({postListIds: [ + 'post1', + 'post2', + 'post3', + 'post4', + 'post5', + DATE_LINE + 1551711600000, + ]}); + + expect(instance.componentDidUpdate).toHaveBeenCalledTimes(3); + expect(instance.componentDidUpdate.mock.calls[2][2]).toEqual({previousScrollTop: 40, previousScrollHeight: 400}); + }); + }); }); diff --git a/package-lock.json b/package-lock.json index f72dd2655fc5..40f12d2f3a5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2192,12 +2192,6 @@ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true }, - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", - "dev": true - }, "array-find": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz", @@ -3438,13 +3432,13 @@ "dev": true }, "cheerio": { - "version": "1.0.0-rc.2", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz", - "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", "dev": true, "requires": { "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", + "dom-serializer": "~0.1.1", "entities": "~1.1.1", "htmlparser2": "^3.9.1", "lodash": "^4.15.0", @@ -4984,20 +4978,18 @@ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" }, "enzyme": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.9.0.tgz", - "integrity": "sha512-JqxI2BRFHbmiP7/UFqvsjxTirWoM1HfeaJrmVSZ9a1EADKkZgdPcAuISPMpoUiHlac9J4dYt81MC5BBIrbJGMg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.8.0.tgz", + "integrity": "sha512-bfsWo5nHyZm1O1vnIsbwdfhU989jk+squU9NKvB+Puwo5j6/Wg9pN5CO0YJelm98Dao3NPjkDZk+vvgwpMwYxw==", "dev": true, "requires": { "array.prototype.flat": "^1.2.1", "cheerio": "^1.0.0-rc.2", "function.prototype.name": "^1.1.0", "has": "^1.0.3", - "html-element-map": "^1.0.0", "is-boolean-object": "^1.0.0", "is-callable": "^1.1.4", "is-number-object": "^1.0.3", - "is-regex": "^1.0.4", "is-string": "^1.0.4", "is-subset": "^0.1.1", "lodash.escape": "^4.0.1", @@ -7729,15 +7721,6 @@ "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==", "dev": true }, - "html-element-map": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.0.0.tgz", - "integrity": "sha512-/SP6aOiM5Ai9zALvCxDubIeez0LvG3qP7R9GcRDnJEP/HBmv0A8A9K0o8+HFudcFt46+i921ANjzKsjPjb7Enw==", - "dev": true, - "requires": { - "array-filter": "^1.0.0" - } - }, "html-encoding-sniffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", @@ -13059,8 +13042,8 @@ "integrity": "sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==" }, "react-window": { - "version": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", - "from": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", + "version": "github:mattermost/react-window#cfb30dc14b065c10a93f3418006408d84c31a80f", + "from": "github:mattermost/react-window#cfb30dc14b065c10a93f3418006408d84c31a80f", "requires": { "@babel/runtime": "^7.0.0", "memoize-one": "^3.1.1" diff --git a/package.json b/package.json index d44be1d6728c..b7edba4538e7 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-select": "2.4.2", "react-transition-group": "2.7.1", "react-virtualized-auto-sizer": "^1.0.2", - "react-window": "github:mattermost/react-window#587e3e9cc5801aef7a10dbe1e664a492efa672f2", + "react-window": "github:mattermost/react-window#cfb30dc14b065c10a93f3418006408d84c31a80f", "rebound": "0.1.0", "redux": "4.0.1", "redux-batched-actions": "0.4.1", @@ -84,7 +84,7 @@ "cross-env": "5.2.0", "css-loader": "2.1.1", "cypress": "3.2.0", - "enzyme": "3.9.0", + "enzyme": "3.8.0", "enzyme-adapter-react-16": "1.11.2", "enzyme-to-json": "3.3.5", "eslint": "5.15.3", From deca54322f0f8106e83fbef4aed6ff410c71e097 Mon Sep 17 00:00:00 2001 From: sudheer Date: Tue, 30 Apr 2019 14:02:23 +0530 Subject: [PATCH 5/6] Remove uneeded arrow func for debounce --- components/post_view/post_list.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/post_view/post_list.jsx b/components/post_view/post_list.jsx index dc6b8788764b..f1203236ced1 100644 --- a/components/post_view/post_list.jsx +++ b/components/post_view/post_list.jsx @@ -241,9 +241,7 @@ export default class PostList extends React.PureComponent { if (error) { if (this.autoRetriesCount < MAX_NUMBER_OF_AUTO_RETRIES) { this.autoRetriesCount++; - debounce(() => { - this.loadMorePosts(); - }); + debounce(this.loadMorePosts()); } else if (this.mounted) { this.setState({autoRetryEnable: false}); } From e3c6be118a747c35ee83c118d634a000a9502d66 Mon Sep 17 00:00:00 2001 From: sudheer Date: Tue, 30 Apr 2019 14:25:13 +0530 Subject: [PATCH 6/6] Update snapshot --- .../__snapshots__/file_attachment.test.jsx.snap | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/file_attachment/__snapshots__/file_attachment.test.jsx.snap b/components/file_attachment/__snapshots__/file_attachment.test.jsx.snap index b4f1f1b7adeb..22f39d638cad 100644 --- a/components/file_attachment/__snapshots__/file_attachment.test.jsx.snap +++ b/components/file_attachment/__snapshots__/file_attachment.test.jsx.snap @@ -9,8 +9,17 @@ exports[`component/FileAttachment should match snapshot, after change from file href="#" onClick={[Function]} > -