Commit Graph

34 Commits

Author SHA1 Message Date
Matt Panaro 9cbbc50fcd Fix 12661 (#12744)
* Revert "persist last-intersected status update and restore when ScrollableList is restored"

This reverts commit 07e26142ef6a8e74bd2ac5e9b461a5a1699bd4c8.

accidentally merged spurious code in https://github.com/tootsuite/mastodon/pull/12661.  https://github.com/tootsuite/mastodon/pull/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 c93df2159fbd3888a5c48d8a8b8ae61dbbc54b89.

accidentally merged spurious code in https://github.com/tootsuite/mastodon/pull/12661.  https://github.com/tootsuite/mastodon/pull/12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
2020-01-02 22:46:42 +01:00
Matt Panaro 2a5da8c961 refactor IntersectionObserver to observe viewport in single-column mode (#12735) 2019-12-31 21:39:25 +01:00
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
Eugen Rochko 50b9276330
Fix unread indicator not updating for notifications (#11923)
Regression from #11898
2019-09-23 02:19:08 +02:00
Eugen Rochko ba0de8fb68
Fix updates being hidden behind pending items on unmounted components (#11898) 2019-09-21 09:12:13 +02:00
ThibG f109867578 Fix “slow mode” issues (#11859)
* Fix weird scroll-jumping behavior with pending items

* Treat pending items as unread items

* Fix scroll position being altered because of the “X new items” button
2019-09-16 15:45:06 +02:00
Eugen Rochko aa22b38fdb
Change single-column mode to scroll the whole page (#11359)
Fix #10840
2019-07-19 09:25:22 +02:00
Eugen Rochko 9b1d3e4acb
Add option to disable real-time updates in web UI (#9984)
Fix #9031
Fix #7913
2019-07-16 06:30:47 +02:00
ThibG aee93bfc9c Fix timeline jumps (#10001)
* Avoid two-step rendering of statuses as much as possible

Cache width shared by Video player, MediaGallery and Cards at the
ScrollableList level, pass it down through StatusList and Notifications.

* Adjust scroll when new preview cards appear

* Adjust scroll when statuses above the current scroll position are deleted
2019-02-11 13:19:59 +01:00
ThibG 8389b496ba Fix unnecessary loadMore calls when the end of a timeline has been reached (#9581)
Fixes #9568
2018-12-19 22:23:16 +01:00
ThibG 55abff8af7 Various fixes to scrollable lists and media gallery (#9501)
* Always use the scrollable class for the ScrollList component

Fixes #9499 as well as empty timelines' scrollbar “blinking”
between loading state and empty state.

* Do not display empty message when the list is known to have more elements

Fixes #9500

* Fix LoadMore usage in account media gallery

(Even though that codepath is probably never actually used…)

* Make account media gallery more consistent with account timeline

Fixes #9498

Display “load more” more consistently, add a loading indicator on first load.

* Fix “load more” button when no data has been fetched
2018-12-12 22:32:44 +01:00
Les Orchard cc1f13dfd0 Only consider mouse move in scrolling on item insertion (#9262)
Fixes #9259
2018-11-11 23:20:20 +01:00
Les Orchard 2f86fc5e0a Identify manual scrolling to cancel scroll to top reset on mouse idle (#9245) 2018-11-09 18:06:43 +01:00
Eugen Rochko dd00cd19d2
Use local instead of global loading indicator for timelines, account timelines (#9224)
So that opening a profile feels faster. Also, pinned toots are not
shown before other toots have loaded. Also, if no toots are loaded,
added empty message
2018-11-08 21:35:06 +01:00
Les Orchard 9cfd610484 Cancel list scroll reset after mouse move on wheel scroll (#9233)
- Use object properties rather than component state for
  mouseMovedRecently and scrollToTopOnMouseIdle flags

- Remove redundant scrollToTop prop call, also fixing an attempt to call
  an undefined prop.

Fixes #9217
2018-11-08 18:45:20 +01:00
Les Orchard 6a1216d2cd Temporarily hold timeline if mouse moved recently (fixes #8630) (#9200)
- On recent mouse movement, hold timeline position so statuses remain in
  place for interactions in progress.

- If the timeline had been scrolled to the top before mouse movement,
  restore scroll on mouse idle.
2018-11-05 18:59:41 +01:00
Jakub Mendyk ceed1ebe5b Fix followers/follows layout issues from #8418 (#8505)
* Add alwaysShowScrollbar prop to ScrollableList

* Fix followers/follows layout issues from #8418
2018-08-29 01:19:58 +02:00
Eugen Rochko 90b64c0069
Always display tab navigation on local/federated timeline even when empty (#7663)
Fix #7659
2018-05-29 02:01:04 +02:00
ThibG e06fbc4fcf Fixes/rollback scroll changes (#7387)
* Revert "Do not re-position scroll when loading more (inserting items from below) (#7344)"

This reverts commit 8c601b54cc.

* Revert "Prevent timeline from moving when cursor is hovering over it (fixes #7278) (#7327)"

This reverts commit 58852695c8.
2018-05-06 22:26:39 +02:00
ThibG 8c601b54cc Do not re-position scroll when loading more (inserting items from below) (#7344) 2018-05-03 22:32:05 +02:00
ThibG 58852695c8 Prevent timeline from moving when cursor is hovering over it (fixes #7278) (#7327) 2018-05-03 12:09:11 +02:00
ThibG 7e0aed398f Fix scrolling behavior (#7151)
* Update React.JS

* Use React's new lifecycles for scrollable lists

* Clean up dead code

* Make CodeClimate happy
2018-04-16 21:04:24 +02:00
Akihiko Odaki 9a1a55ce52 Allow clients to fetch statuses made while they were offline (#6876) 2018-03-24 15:25:15 +01:00
Akihiko Odaki b0664a5e6c Replace onScrollToBottom with onLoadMore (#6615)
onScrollToBottom was a function to run instead of onScrollToTop and
onScroll when scrolling to the bottom. The behavior to prevent
onScrollToTop was inconvenient because the viewport can be at the bottom
and at the top at the same time if the viewport is larger than the
container.

onScrollToBottom was also called when the button to load more is clicked
on contray to the name suggests, which led notifications and
status_list_container components to mark the scrolled location is not at
the top mistakenly.

onLoadMore is a replacement for onScrollToBottom. It will be called
independently from onScrollToTop and onScroll.
2018-03-05 19:31:40 +01:00
Yamagishi Kazutoshi 763a2f8511
Replace react-router-scroll to react-router-scroll-4 (#5568) 2017-11-01 06:58:38 +09:00
Eugen Rochko 7db0f8dcb2 Implement hotkeys for web UI (#5164)
* Fix #2102 - Implement hotkeys

Hotkeys on status list:

- r to reply
- m to mention author
- f to favourite
- b to boost
- enter to open status
- p to open author's profile
- up or k to move up in the list
- down or j to move down in the list
- 1-9 to focus a status in one of the columns
- n to focus the compose textarea
- alt+n to start a brand new toot
- backspace to navigate back

* Add navigational hotkeys

The key g followed by:

- s: start
- h: home
- n: notifications
- l: local timeline
- t: federated timeline
- f: favourites
- u: own profile
- p: pinned toots
- b: blocked users
- m: muted users

* Add hotkey for focusing search, make escape un-focus compose/search

* Fix focusing notifications column, fix hotkeys in compose textarea
2017-10-06 01:07:59 +02:00
Nolan Lawson c567c87453 Toggle contain:strict on fullscreen (#5159)
* Toggle contain:strict on fullscreen

* Fix scss lint issue

* fix scss whitespace lint issue
2017-10-02 03:01:01 +02:00
unarist 6c81f9d6e5 Fix invisible load more button (#4962)
* Fix behavior while the button is invisible
e.g. pointer cursor, couldn't open contextmenu
* Avoid rendering the button to remove blank space if no more items are available or no items are rendered
2017-09-16 00:32:43 +02:00
abcang 60944d5dca Fix height cache (#4909) 2017-09-13 10:24:33 +02:00
Eugen Rochko bdc8b4fd91 Disable mouse-based pause from #4859 (#4865)
It wasn't working ideally and introduced some annoying false positivies
2017-09-09 15:09:50 +02:00
unarist c7908e2d09 Fix scroll behavior and others on paused timeline (#4864)
Resolved:

* Lot of redundant renders while mouse moving
* Scroll jumping when timeline loaded
* Scroll position isn't kept when statuses below the scrollTop was deleted then new status arrived

Unresolved:

* Scroll position isn't kept when statuses over the scrollTop was deleted then new status arrived
-> It needs to know which statuses are over the scrollTop
* New status indicator should be active when new statuses arrived while mouse moved recently
-> It needs a) update indicator in ScrollableList, or b) set scrollTop status while mouse moving
2017-09-09 14:16:11 +02:00
Eugen Rochko baa8b82179 Fix #1004 - Temporarily pause timeline if there's been recent mouse movement (#4859) 2017-09-09 02:26:41 +02:00
Clworld 1646f622a5 fix scroll position (#4821) 2017-09-06 17:29:56 +02:00
abcang 0827c09c44 Generalized the infinite scrollable list (#4697) 2017-08-28 22:23:44 +02:00