diff options
author | Ivan Chen <ivan@thetaggid.com> | 2021-01-14 14:06:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 14:06:07 -0500 |
commit | 007dcc5c836f1b368042c530d22f5421610efb7c (patch) | |
tree | 9ea1254dcaa1c5b0ff1753a9da2c80b93be84860 /src/components/profile/ProfilePreview.tsx | |
parent | 82476e27fe6f5dc699370659d223dcd86fd5c76b (diff) |
created navigation to comment from notification (#184)
Diffstat (limited to 'src/components/profile/ProfilePreview.tsx')
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 6f008540..134e94cd 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -134,21 +134,23 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ } } + const userXId = + loggedInUser.username === user.username ? undefined : user.id; + /** - * Dispatch an event to Fetch the user details - * If the user is already present in store, do not fetch again - * Finally, Navigate to profile of the user selected + * Dispatch an event to Fetch the user details only if we're navigating to + * a userX's profile. + * If the user is already present in store, do not fetch again. + * Finally, Navigate to profile of the user selected. */ - - if (!userXInStore(state, screenType, user.id)) { + if (userXId && !userXInStore(state, screenType, user.id)) { await fetchUserX( dispatch, {userId: user.id, username: user.username}, screenType, ); } - const userXId = - loggedInUser.username === user.username ? undefined : user.id; + navigation.push('Profile', { userXId, screenType, |