@@ -30,6 +30,11 @@ import {
3030 type LfsLock ,
3131} from "./lib" ;
3232import { LfsUnlockModal } from "./components/shared/LfsUnlockModal" ;
33+ import {
34+ loadAutoFetchSettings ,
35+ saveAutoFetchSettings ,
36+ type AutoFetchSettings ,
37+ } from "./hooks/useAutoFetch" ;
3338
3439const BASE_INNER_TABS = [
3540 { id : "pending" , label : "Pending Changes" } ,
@@ -47,6 +52,7 @@ interface RepoTabState {
4752 repoName : string ;
4853 activeTab : string ;
4954 refreshKey : number ;
55+ silentRefreshKey : number ;
5056}
5157
5258const STORAGE_KEY = "repoTabs_v2" ;
@@ -90,6 +96,7 @@ function App() {
9096 const [ lfsLockCount , setLfsLockCount ] = useState ( 0 ) ;
9197 const [ worktreeCount , setWorktreeCount ] = useState ( 0 ) ;
9298 const [ showPluginModal , setShowPluginModal ] = useState ( false ) ;
99+ const [ autoFetchSettings , setAutoFetchSettings ] = useState < AutoFetchSettings > ( loadAutoFetchSettings ) ;
93100 const [ lfsUnlockConfirm , setLfsUnlockConfirm ] = useState < {
94101 repoPath : string ;
95102 locks : LfsLock [ ] ;
@@ -114,6 +121,7 @@ function App() {
114121 repoName : s . repoName ,
115122 activeTab : "pending" ,
116123 refreshKey : 0 ,
124+ silentRefreshKey : 0 ,
117125 } ) ) ;
118126 setRepoTabs ( tabs ) ;
119127 const lastActive = localStorage . getItem ( "activeRepoId" ) ;
@@ -159,6 +167,14 @@ function App() {
159167 updateActiveRepo ( ( t ) => ( { refreshKey : t . refreshKey + 1 } ) ) ;
160168 } , [ updateActiveRepo ] ) ;
161169
170+ const handleSilentRefresh = useCallback ( ( ) => {
171+ setRepoTabs ( ( prev ) =>
172+ prev . map ( ( t ) =>
173+ t . id === activeRepoId ? { ...t , silentRefreshKey : t . silentRefreshKey + 1 } : t
174+ )
175+ ) ;
176+ } , [ activeRepoId ] ) ;
177+
162178 const handleAfterPush = useCallback ( async ( repoPath : string ) => {
163179 try {
164180 const myLocks = await getLfsLocalLocks ( repoPath ) ;
@@ -172,6 +188,11 @@ function App() {
172188 }
173189 } , [ ] ) ;
174190
191+ const handleAutoFetchSettingsChange = useCallback ( ( settings : AutoFetchSettings ) => {
192+ saveAutoFetchSettings ( settings ) ;
193+ setAutoFetchSettings ( settings ) ;
194+ } , [ ] ) ;
195+
175196 const handleLfsUnlockConfirm = useCallback ( async ( ) => {
176197 if ( ! lfsUnlockConfirm ) return ;
177198 const { repoPath, locks } = lfsUnlockConfirm ;
@@ -290,6 +311,7 @@ function App() {
290311 repoName : repoNameFromPath ( root ) ,
291312 activeTab : "pending" ,
292313 refreshKey : 0 ,
314+ silentRefreshKey : 0 ,
293315 } ;
294316
295317 setRepoTabs ( ( prev ) => {
@@ -429,6 +451,9 @@ function App() {
429451 plugins = { plugins }
430452 selectedFilePath = { selectedFilePath }
431453 onTimeLapse = { ( ) => setShowTimeLapse ( true ) }
454+ autoFetchSettings = { autoFetchSettings }
455+ onAutoFetchSettingsChange = { handleAutoFetchSettingsChange }
456+ onSilentRefresh = { handleSilentRefresh }
432457 />
433458
434459 { /* Body: left sidebar + main content */ }
@@ -466,6 +491,7 @@ function App() {
466491 < PendingTab
467492 repoPath = { activeRepo . repoPath }
468493 refreshKey = { activeRepo . refreshKey }
494+ silentRefreshKey = { activeRepo . silentRefreshKey }
469495 onFilePreview = { ( filename , staged ) => { setSelectedDiff ( null ) ; setPendingFilePreview ( { filename, staged } ) ; } }
470496 onLfsLockCountChange = { setLfsLockCount }
471497 onShowInWorkspaceFile = { ( absolutePath ) => {
@@ -490,6 +516,7 @@ function App() {
490516 repoPath = { activeRepo . repoPath }
491517 filePath = { selectedFilePath }
492518 refreshKey = { activeRepo . refreshKey }
519+ silentRefreshKey = { activeRepo . silentRefreshKey }
493520 onRefresh = { handleRefresh }
494521 onFileSelect = { setSelectedDiff }
495522 onClearPath = { ( ) => setSelectedFilePath ( null ) }
@@ -511,6 +538,7 @@ function App() {
511538 < BranchTab
512539 repoPath = { activeRepo . repoPath }
513540 refreshKey = { activeRepo . refreshKey }
541+ silentRefreshKey = { activeRepo . silentRefreshKey }
514542 onRefresh = { handleRefresh }
515543 />
516544 ) }
0 commit comments