From 4d1c6da2b808d6c2b89431ac225c559fd174d400 Mon Sep 17 00:00:00 2001
From: xaralis <filip.varecha@fragaria.cz>
Date: Thu, 7 Jan 2021 11:47:46 +0100
Subject: [PATCH] fix: do not reset listing window when item list changes

---
 src/components/posts/Post.jsx     | 2 +-
 src/components/posts/PostList.jsx | 7 +------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/components/posts/Post.jsx b/src/components/posts/Post.jsx
index f6262e8..6c996cb 100644
--- a/src/components/posts/Post.jsx
+++ b/src/components/posts/Post.jsx
@@ -338,4 +338,4 @@ const Post = ({
   );
 };
 
-export default Post;
+export default React.memo(Post);
diff --git a/src/components/posts/PostList.jsx b/src/components/posts/PostList.jsx
index e80a6fd..e4f1f7c 100644
--- a/src/components/posts/PostList.jsx
+++ b/src/components/posts/PostList.jsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect, useMemo, useState } from "react";
+import React, { useCallback, useMemo, useState } from "react";
 import classNames from "classnames";
 
 import Post from "./Post";
@@ -50,11 +50,6 @@ const PostList = ({
     onRejectProcedureProposalByChairman
   );
 
-  // Reset window when items change (possibly due to filtering).
-  useEffect(() => {
-    setWindow(windowSize);
-  }, [items, setWindow]);
-
   const onPostSeen = useCallback(
     (post) => () => {
       if (!post.seen) {
-- 
GitLab