chinwagsocial/app/javascript/mastodon/containers
Matt Panaro 31f7c3fc5d Summary: fix slowness due to layout thrashing when reloading a large … (#12661)
* Summary: fix slowness due to layout thrashing when reloading a large set of status updates

in order to limit the maximum size of a status in a list view (e.g. the home timeline), so as to avoid having to scroll all the way through an abnormally large status update (see https://github.com/tootsuite/mastodon/pull/8205), the following steps are taken:
•the element containing the status is rendered in the browser
•its height is calculated, to determine if it exceeds the maximum height threshold.
Unfortunately for performance, these steps are carried out in the componentDidMount(/Update) method, which also performs style modifications on the element.  The combination of  height request and style modification during javascript evaluation in the browser leads to layout-thrashing, where the elements are repeatedly re-laid-out (see https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing & https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Performance_best_practices_for_Firefox_fe_engineers).
The solution implemented here is to memoize the collapsed state in Redux the first time the status is seen (e.g. when fetched as part of a small batch, to populate the home timeline) , so that on subsequent re-renders, the value can be queried, rather than recalculated.  This strategy is derived from https://github.com/tootsuite/mastodon/pull/4439 & https://github.com/tootsuite/mastodon/pull/4909, and should resolve https://github.com/tootsuite/mastodon/issues/12455.

Andrew Lin (https://github.com/onethreeseven) is thanked for his assistance in root cause analysis and solution brainstorming

* remove getSnapshotBeforeUpdate from status

* remove componentWillUnmount from status

* persist last-intersected status update and restore when ScrollableList is restored

e.g. when navigating from home-timeline to a status conversational  thread and <Back again

* cache currently-viewing status id to avoid calling redux with identical value

* refactor collapse toggle to pass explicit boolean
2019-12-29 05:39:48 +01:00
..
account_container.js Optional notification muting (#5087) 2017-11-15 03:56:41 +01:00
compose_container.js Fix not showing custom emojis in share page emoji picker (#9970) 2019-02-04 23:14:57 +01:00
domain_container.js Upgrade ESLint to v5.x (#9694) 2019-01-02 07:28:53 +01:00
dropdown_menu_container.js Fix account dropdown not opening due to regression from #12377 (#12430) 2019-11-20 00:56:22 +01:00
intersection_observer_article_container.js Fix height cache (#4909) 2017-09-13 10:24:33 +02:00
mastodon.js Fix scroll position resetting when opening media modals in web UI (#11815) 2019-09-12 20:14:59 +02:00
media_container.js Do not add margin light when opening modal on mobile (#11830) 2019-09-29 14:30:58 +02:00
poll_container.js Add polls (#10111) 2019-03-03 22:18:23 +01:00
status_container.js Summary: fix slowness due to layout thrashing when reloading a large … (#12661) 2019-12-29 05:39:48 +01:00
timeline_container.js Redesign landing page (#10232) 2019-03-12 17:34:00 +01:00