aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-03 18:28:56 +0800
committercrupest <crupest@outlook.com>2021-06-03 18:28:56 +0800
commit44141e188eef44fd4fd1c77aee7df168b68765b1 (patch)
treee8f8c55b578b4676e61511bf65ed4425e4f95d19 /FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
parent2cbb0aa75edbaf5269a4a3fdf52452834cf7ed04 (diff)
downloadtimeline-44141e188eef44fd4fd1c77aee7df168b68765b1.tar.gz
timeline-44141e188eef44fd4fd1c77aee7df168b68765b1.tar.bz2
timeline-44141e188eef44fd4fd1c77aee7df168b68765b1.zip
fix: Don't know this is No.which attemp to fix scroll to top bug.
Diffstat (limited to 'FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx')
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
index c9fec919..2f778ab1 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
@@ -28,15 +28,18 @@ const TimelinePostView: React.FC<TimelinePostViewProps> = (props) => {
React.useState<boolean>(false);
const [deleteDialog, setDeleteDialog] = React.useState<boolean>(false);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const cardRef = React.useRef<HTMLDivElement>(null!);
+ const cardRef = React.useRef<HTMLDivElement>(null);
React.useEffect(() => {
const cardIntersectionObserver = new IntersectionObserver(([e]) => {
if (e.intersectionRatio > 0) {
- cardRef.current.style.animationName = "timeline-post-enter";
+ if (cardRef.current != null) {
+ cardRef.current.style.animationName = "timeline-post-enter";
+ }
}
});
- cardIntersectionObserver.observe(cardRef.current);
+ if (cardRef.current) {
+ cardIntersectionObserver.observe(cardRef.current);
+ }
return () => {
cardIntersectionObserver.disconnect();