fix(dashboard): address code review feedback for PR #336

- Fix documentation: config.yaml -> settings.json in backups-section
- Wrap restoreBackup in useCallback for callback stability
- Auth middleware verified: inherited from app.use(authMiddleware)
This commit is contained in:
kaitranntt committed 2026-01-14 16:51:56 -05:00
1 parent 623a3146d7
commit e808972df0
1 file changed
+9 -6
@@ -1,6 +1,6 @@
/** /**
* Backups Section * Backups Section
* Settings section for managing config.yaml backups (list and restore) * Settings section for managing settings.json backups (list and restore)
*/ */
import { useEffect, useState, useCallback, useRef } from 'react'; import { useEffect, useState, useCallback, useRef } from 'react';
@@ -73,8 +73,9 @@ export default function BackupsSection() {
} }
}, []); }, []);
// Restore backup // Restore backup (wrapped in useCallback for callback stability)
const restoreBackup = async (timestamp: string) => { const restoreBackup = useCallback(
async (timestamp: string) => {
// Abort previous restore request // Abort previous restore request
restoreAbortControllerRef.current?.abort(); restoreAbortControllerRef.current?.abort();
restoreAbortControllerRef.current = new AbortController(); restoreAbortControllerRef.current = new AbortController();
@@ -104,7 +105,9 @@ export default function BackupsSection() {
} finally { } finally {
setRestoring(null); setRestoring(null);
} }
}; },
[fetchBackups, fetchRawConfig]
);
// Load on mount // Load on mount
useEffect(() => { useEffect(() => {
@@ -199,8 +202,8 @@ export default function BackupsSection() {
<h2 className="text-lg font-semibold">Settings Backups</h2> <h2 className="text-lg font-semibold">Settings Backups</h2>
</div> </div>
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
Restore previous versions of your config.yaml file. Backups are created automatically Restore previous versions of your settings.json file. Backups are created
when settings are modified. automatically when settings are modified.
</p> </p>
</div> </div>