diff options
author | crupest <crupest@outlook.com> | 2021-04-04 14:43:26 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-04 14:43:26 +0800 |
commit | 2c4967facc546e718f5a2f4c9324722324b1f4a5 (patch) | |
tree | 32219003468a90f80bc9cf97b60ea9ae9f7c903d /FrontEnd/src/app/views | |
parent | 4899fac577f92d3c3feade4869621ef6979460c1 (diff) | |
download | timeline-2c4967facc546e718f5a2f4c9324722324b1f4a5.tar.gz timeline-2c4967facc546e718f5a2f4c9324722324b1f4a5.tar.bz2 timeline-2c4967facc546e718f5a2f4c9324722324b1f4a5.zip |
...
Diffstat (limited to 'FrontEnd/src/app/views')
-rw-r--r-- | FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx | 4 | ||||
-rw-r--r-- | FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx | 11 |
2 files changed, 5 insertions, 10 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx index 704e51fb..1c8873f9 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx @@ -10,6 +10,8 @@ import { getAlertHost } from "@/services/alert"; import Timeline from "./Timeline"; import TimelinePostEdit from "./TimelinePostEdit"; +import useReverseScrollPositionRemember from "@/utilities/useReverseScrollPositionRemember"; + export interface TimelinePageCardProps { timeline: HttpTimelineInfo; collapse: boolean; @@ -35,6 +37,8 @@ const TimelinePageTemplate: React.FC<TimelinePageTemplateProps> = (props) => { HttpTimelineInfo | "loading" | "offline" | "notexist" | "error" >("loading"); + useReverseScrollPositionRemember(); + React.useEffect(() => { setTimeline("loading"); }, [timelineName]); diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx index b91357dd..e0534695 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx @@ -1,6 +1,7 @@ import React from "react"; import { HttpTimelinePostInfo } from "@/http/timeline"; + import TimelinePostListView from "./TimelinePostListView"; export interface TimelinePagedPostListViewProps { @@ -38,16 +39,6 @@ const TimelinePagedPostListView: React.FC<TimelinePagedPostListViewProps> = ( } }, [lastViewCount, posts]); - React.useEffect(() => { - if (lastViewCount !== 10) { - document - .getElementById( - `timeline-post-${posts[posts.length - (lastViewCount - 10)].id}` - ) - ?.scrollIntoView(true); - } - }, [lastViewCount, posts]); - return ( <TimelinePostListView className={className} |