@@ -18,6 +18,7 @@ import { Header } from "../components/Header";
1818import { Sidebar } from "../components/Sidebar" ;
1919import { useLocalStorage } from "../hooks/useLocalStorage" ;
2020import { Stack , TextField } from "@mui/material" ;
21+ import { useAuth } from "../lib/auth" ;
2122
2223const DrawerWidth = 240 ;
2324const SIDEBAR_KEY = "sidebar" ;
@@ -160,6 +161,7 @@ function RepoImpl() {
160161 const deleteClient = useStore ( store , ( state ) => state . deleteClient ) ;
161162
162163 const { loading, me } = useMe ( ) ;
164+ const { hasToken } = useAuth ( ) ;
163165 useEffect ( ( ) => {
164166 if ( me ) {
165167 setSessionId ( `${ me . id } _${ id } ` ) ;
@@ -184,17 +186,32 @@ function RepoImpl() {
184186 } ) ;
185187 } ) ;
186188 }
187- } , [ provider ] ) ;
189+ } , [ addClient , deleteClient , provider ] ) ;
188190
189191 useEffect ( ( ) => {
190192 resetState ( ) ;
191193 setRepo ( id ! ) ;
192- // load the repo. It is actually not a queue, just an async thunk
193- loadRepo ( client , id ! ) ;
194- if ( ! loading && me ) {
195- setUser ( me ) ;
194+ if ( hasToken ( ) ) {
195+ if ( ! loading && me ) {
196+ setUser ( me ) ;
197+ // load the repo. It is actually not a queue, just an async thunk
198+ loadRepo ( client , id ! ) ;
199+ }
200+ } else {
201+ // not signed in, just load the repo
202+ loadRepo ( client , id ! ) ;
196203 }
197- } , [ client , id , loadRepo , resetState , setRepo , me , loading , setUser ] ) ;
204+ } , [
205+ client ,
206+ id ,
207+ loadRepo ,
208+ resetState ,
209+ setRepo ,
210+ me ,
211+ loading ,
212+ setUser ,
213+ hasToken ,
214+ ] ) ;
198215
199216 // FIXME Removing queueL. This will cause Repo to be re-rendered a lot of
200217 // times, particularly the delete pod action would cause syncstatus and repo
0 commit comments