@@ -146,7 +168,7 @@ const ScrollableList = React.forwardRef
(({
);
};
- /** Render a single item */
+ /** Render a single item. */
const renderItem = (_i: number, element: JSX.Element): JSX.Element => {
if (showPlaceholder) {
return ;
@@ -192,7 +214,7 @@ const ScrollableList = React.forwardRef(({
return 0;
}, [showLoading, initialTopMostItemIndex]);
- /** Render the actual Virtuoso list */
+ /** Render the actual Virtuoso list. */
const renderFeed = (): JSX.Element => (
(({
/>
);
- /** Conditionally render inner elements */
+ /** Conditionally render inner elements. */
const renderBody = (): JSX.Element => {
if (isEmpty) {
return renderEmpty();
diff --git a/app/soapbox/components/status_list.tsx b/app/soapbox/components/status_list.tsx
index a421f62a3..37e37f59d 100644
--- a/app/soapbox/components/status_list.tsx
+++ b/app/soapbox/components/status_list.tsx
@@ -14,24 +14,31 @@ import type { VirtuosoHandle } from 'react-virtuoso';
import type { IScrollableList } from 'soapbox/components/scrollable_list';
interface IStatusList extends Omit {
+ /** Unique key to preserve the scroll position when navigating back. */
scrollKey: string,
+ /** List of status IDs to display. */
statusIds: ImmutableOrderedSet,
+ /** Last _unfiltered_ status ID (maxId) for pagination. */
lastStatusId?: string,
+ /** Pinned statuses to show at the top of the feed. */
featuredStatusIds?: ImmutableOrderedSet,
+ /** Pagination callback when the end of the list is reached. */
onLoadMore?: (lastStatusId: string) => void,
+ /** Whether the data is currently being fetched. */
isLoading: boolean,
+ /** Whether the server did not return a complete page. */
isPartial?: boolean,
+ /** Whether we expect an additional page of data. */
hasMore: boolean,
- prepend?: React.ReactNode,
+ /** Message to display when the list is loaded but empty. */
emptyMessage: React.ReactNode,
- alwaysPrepend?: boolean,
+ /** ID of the timeline in Redux. */
timelineId?: string,
- queuedItemSize?: number,
- onScrollToTop?: () => void,
- onScroll?: () => void,
+ /** Whether to display a gap or border between statuses in the list. */
divideType: 'space' | 'border',
}
+/** Feed of statuses, built atop ScrollableList. */
const StatusList: React.FC = ({
statusIds,
lastStatusId,
@@ -68,11 +75,11 @@ const StatusList: React.FC = ({
};
const handleLoadOlder = useCallback(debounce(() => {
- const loadMoreID = lastStatusId || statusIds.last();
- if (onLoadMore && loadMoreID) {
- onLoadMore(loadMoreID);
+ const maxId = lastStatusId || statusIds.last();
+ if (onLoadMore && maxId) {
+ onLoadMore(maxId);
}
- }, 300, { leading: true }), []);
+ }, 300, { leading: true }), [onLoadMore, lastStatusId, statusIds.last()]);
const selectChild = (index: number) => {
node.current?.scrollIntoView({
diff --git a/app/soapbox/features/community_timeline/index.js b/app/soapbox/features/community_timeline/index.js
index 1ccc6076f..cb64b49b3 100644
--- a/app/soapbox/features/community_timeline/index.js
+++ b/app/soapbox/features/community_timeline/index.js
@@ -9,7 +9,7 @@ import { expandCommunityTimeline } from 'soapbox/actions/timelines';
import SubNavigation from 'soapbox/components/sub_navigation';
import { Column } from 'soapbox/components/ui';
-import StatusListContainer from '../ui/containers/status_list_container';
+import Timeline from '../ui/components/timeline';
import ColumnSettings from './containers/column_settings_container';
@@ -81,7 +81,7 @@ class CommunityTimeline extends React.PureComponent {
return (
- {
onSelected={handleSuggestion}
/>
- {
const me = state.get('me');
@@ -90,7 +90,7 @@ class GroupTimeline extends React.PureComponent {
)}
- ({
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,
@@ -114,7 +114,7 @@ class HashtagTimeline extends React.PureComponent {
return (
- }
) : (
- {
*/}
-
{filterBarContainer}
-
}
-