chinwagsocial/app/javascript/mastodon/reducers
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
..
accounts.js
accounts_counters.js
alerts.js Add special alert for throttled requests (#11677) 2019-08-27 16:50:39 +02:00
blocks.js Add explanation to mute dialog, refactor and clean up mute/block UI (#11992) 2019-09-29 21:46:05 +02:00
compose.js Fix pending upload count not being decremented on error (#12499) 2019-11-29 17:02:18 +01:00
contexts.js
conversations.js Fix delete conversation action not being reflected in web UI (#12030) 2019-10-01 04:54:17 +02:00
custom_emojis.js
domain_lists.js
dropdown_menu.js
filters.js
height_cache.js
identity_proofs.js
index.js Add explanation to mute dialog, refactor and clean up mute/block UI (#11992) 2019-09-29 21:46:05 +02:00
list_adder.js
list_editor.js
lists.js
media_attachments.js
meta.js
missed_updates.js Change title bar to only show unread notifications (#11572) 2019-08-15 20:28:44 +02:00
modal.js
mutes.js Add explanation to mute dialog, refactor and clean up mute/block UI (#11992) 2019-09-29 21:46:05 +02:00
notifications.js Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00
polls.js
push_notifications.js Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00
relationships.js
reports.js
search.js
settings.js Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00
status_lists.js Add bookmarks (#7107) 2019-11-13 23:02:10 +01:00
statuses.js Summary: fix slowness due to layout thrashing when reloading a large … (#12661) 2019-12-29 05:39:48 +01:00
suggestions.js
timelines.js Summary: fix slowness due to layout thrashing when reloading a large … (#12661) 2019-12-29 05:39:48 +01:00
trends.js Add trends UI with admin and user settings (#11502) 2019-08-06 17:57:52 +02:00
user_lists.js Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00