Skip to content

Commit

Permalink
fix reset selectedPost state
Browse files Browse the repository at this point in the history
  • Loading branch information
siefimov committed Oct 9, 2024
1 parent 61dee3e commit a83bb35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/PostsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export const PostsList: React.FC<Props> = ({ onPostSelect, selectedUser }) => {
};

loadPosts();
}, [selectedUser]);
setSelectedPost(null);
onPostSelect(null);
}, [selectedUser, onPostSelect]);

if (isLoading) {
return <Loader />;
Expand Down

0 comments on commit a83bb35

Please sign in to comment.