Skip to content

Commit

Permalink
Fix hidden posts list not updating (aeharding#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
burakcan authored Jul 6, 2023
1 parent 7aeae84 commit ee21b36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/profile/ProfileFeedHiddenPostsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import PostCommentFeed, {
} from "../../features/feed/PostCommentFeed";
import { handleSelector, jwtSelector } from "../../features/auth/authSlice";
import { IPostMetadata, db } from "../../services/db";
import { postHiddenByIdSelector } from "../../features/post/postSlice";

export const InsetIonItem = styled(IonItem)`
--background: var(--ion-tab-bar-background, var(--ion-color-step-50, #fff));
Expand All @@ -42,6 +43,9 @@ export default function ProfileFeedHiddenPostsPage() {
const client = useClient();
const postById = useAppSelector((state) => state.post.postById);

// This is just used to trigger a re-render when the list changes
const postHiddenById = useAppSelector(postHiddenByIdSelector);

const lastPageNumberRef = useRef(1);
const lastPageItemsRef = useRef<IPostMetadata[]>([]);

Expand Down Expand Up @@ -82,7 +86,7 @@ export default function ProfileFeedHiddenPostsPage() {
);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[client, handle, jwt]
[client, handle, jwt, postHiddenById]
);

return (
Expand Down

0 comments on commit ee21b36

Please sign in to comment.