-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Summary: fix slowness due to layout thrashing when reloading a large … #12661
The head ref may contain hidden characters: "issue-12455\u2014slow-back-button"
Summary: fix slowness due to layout thrashing when reloading a large … #12661
Conversation
hold off on merging this: I've introduced a bug when viewing a status thread where if the text is too long it's hidden by a too-small div |
Please also check code style errors found by CodeClimate! |
58f21c4
to
ee1abd6
Compare
…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 mastodon#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 mastodon#4439 & mastodon#4909, and should resolve mastodon#12455. Andrew Lin (https://github.com/onethreeseven) is thanked for his assistance in root cause analysis and solution brainstorming
…t is restored e.g. when navigating from home-timeline to a status conversational thread and <Back again
b1e88da
to
c5f8fd5
Compare
…a large … (mastodon#12661)" This reverts commit 31f7c3f.
…loading a large … (mastodon#12661)"" This reverts commit 1e7b5fb.
…lableList is restored" This reverts commit 07e2614. accidentally merged spurious code in mastodon#12661. mastodon#12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
… identical value" This reverts commit c93df21. accidentally merged spurious code in mastodon#12661. mastodon#12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
* Revert "persist last-intersected status update and restore when ScrollableList is restored" This reverts commit 07e2614. accidentally merged spurious code in #12661. #12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list * Revert "cache currently-viewing status id to avoid calling redux with identical value" This reverts commit c93df21. accidentally merged spurious code in #12661. #12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
My instance is on 3.1 now, and it does seem better! Thanks! |
This reintroduces a lot of issues with the TL moving on its own when a status is deleted etc. |
…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 #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 #4439 & #4909, and should resolve #12455.
Andrew Lin (https://github.com/onethreeseven) is thanked for his assistance in root cause analysis and solution brainstorming