hometown/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_counters.js Store objects to IndexedDB (#6826) 2018-03-24 13:06:27 +01:00
accounts.js Store objects to IndexedDB (#6826) 2018-03-24 13:06:27 +01:00
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 Fix context building in the reducer (#7671) 2018-05-29 17:42:29 +02:00
conversations.js Fix delete conversation action not being reflected in web UI (#12030) 2019-10-01 04:54:17 +02:00
custom_emojis.js retrieve custom emoji list via API instead of before page load (#7047) 2018-04-04 22:25:34 +02:00
domain_lists.js Fix error when unmuting a domain without listing muted domains first (#7670) 2018-05-29 16:25:05 +02:00
dropdown_menu.js Only focus first element of dropdown menus if using keyboard (#8679) 2018-09-13 20:31:33 +02:00
filters.js Keyword/phrase filtering (#7905) 2018-06-29 15:34:36 +02:00
height_cache.js Fix height cache (#4909) 2017-09-13 10:24:33 +02:00
identity_proofs.js squashed identity proof updates (#10375) 2019-03-28 18:01:09 +01:00
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 Implement adding a user to a list from their profile (#9062) 2018-11-05 18:52:38 +01:00
list_editor.js Add list title editing (#9748) 2019-02-13 18:52:02 +01:00
lists.js Add list of lists component to web UI (#5811) 2017-12-05 23:02:27 +01:00
media_attachments.js refactor: Rewrite immutablejs import statements using destructuring (#4147) 2017-07-11 01:00:14 +02:00
meta.js Refactor initial state: "me" (#5563) 2017-10-31 11:27:48 +09:00
missed_updates.js Change title bar to only show unread notifications (#11572) 2019-08-15 20:28:44 +02:00
modal.js Improve dropdown menu keyboard navigation (#11491) 2019-08-06 11:59:46 +02:00
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 Fix poll options not rendering text after vote/refresh (#10189) 2019-03-06 05:35:52 +01:00
push_notifications.js Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00
relationships.js Optimize the process of following someone (#9220) 2018-11-08 21:05:42 +01:00
reports.js Federated reports (#6570) 2018-02-28 06:54:55 +01:00
search.js Fix crash when expanding search results for hashtags (#11447) 2019-07-30 12:06:21 +02:00
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 Change account domain block to clear out notifications and follows (#11393) 2019-07-25 04:17:35 +02:00
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