aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/ProfilePage.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-10 00:19:17 +0300
committereug-vs <eug-vs@keemail.me>2020-08-10 00:19:17 +0300
commitdfa6f0a8d1415539e1ff6a3ca848627bbe87b470 (patch)
tree2d2f6cdf85e10acef7b675f5f91e0e50bb8f7f87 /src/pages/ProfilePage/ProfilePage.tsx
parentfd6e663a1bcc43cfc49bda99ccbfab380489324b (diff)
downloadwhich-ui-dfa6f0a8d1415539e1ff6a3ca848627bbe87b470.tar.gz
fix: show Feed loading correctly
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index 9e00784..db27d25 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -5,6 +5,7 @@ import { Container } from '@material-ui/core';
import ProfileInfo from './ProfileInfo';
import Feed from '../../components/Feed/Feed';
+import Loading from '../../components/Loading/Loading';
import { useAuth } from '../../hooks/useAuth';
import { useUser, useProfile } from '../../hooks/APIClient';
@@ -15,7 +16,7 @@ const ProfilePage: React.FC = () => {
const { user } = useAuth();
const { data: userInfo, mutate: setUserInfo } = useUser(username);
- const { data: polls } = useProfile(userInfo?._id);
+ const { data: polls, isValidating } = useProfile(userInfo?._id);
useEffect(() => {
if (!username) {
@@ -43,7 +44,10 @@ const ProfilePage: React.FC = () => {
savedPolls={polls.length}
totalVotes={totalVotes}
/>
- <Feed polls={polls} />
+ {!polls.length && isValidating
+ ? <Loading />
+ : <Feed polls={polls} />
+ }
</Container>
);
};