From 0be8af8c492059c8501da7c9a3ac5aaf95d90d7c Mon Sep 17 00:00:00 2001 From: Hebi Li Date: Tue, 29 Nov 2022 12:15:54 -0800 Subject: [PATCH] fix setloading recursive rendering issue --- ui/src/pages/repos/index.tsx | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/ui/src/pages/repos/index.tsx b/ui/src/pages/repos/index.tsx index 15389b86..636cbeef 100644 --- a/ui/src/pages/repos/index.tsx +++ b/ui/src/pages/repos/index.tsx @@ -188,17 +188,10 @@ function RepoLine({ repo, deletable, sharable }) { ); } -function Repos({ - url = FETCH_REPOS, - type = RepoTypes.repo, - onLoading = (load) => {}, -}) { +function Repos({ url = FETCH_REPOS, type = RepoTypes.repo }) { const { loading, error, data } = useQuery(url); if (loading) { - onLoading(loading); - return null; - } else { - onLoading(loading); + return ; } if (error) { return null; @@ -299,8 +292,7 @@ function NoLogginErrorAlert() { } export default function Page() { const { me } = useMe(); - const [loading, setLoading] = useState(true); - if (!me && !loading) { + if (!me) { return ; } return ( @@ -319,21 +311,7 @@ export default function Page() { 👋 Welcome, {me?.firstname}! Please open or create a repository to get started. - {loading && ( - - - - )} - { - setLoading(value); - }} - /> + );