Add cache load spinner (build 271261238)

This commit is contained in:
2026-01-27 12:39:51 +13:00
parent 0e95f94025
commit 7d6cdcbe02
3 changed files with 24 additions and 3 deletions

View File

@@ -125,6 +125,7 @@ export default function SettingsPage({ section }: SettingsPageProps) {
const [cacheRows, setCacheRows] = useState<any[]>([])
const [cacheCount, setCacheCount] = useState(50)
const [cacheStatus, setCacheStatus] = useState<string | null>(null)
const [cacheLoading, setCacheLoading] = useState(false)
const [requestsSync, setRequestsSync] = useState<any | null>(null)
const [artworkPrefetch, setArtworkPrefetch] = useState<any | null>(null)
const [artworkSummary, setArtworkSummary] = useState<any | null>(null)
@@ -667,6 +668,7 @@ export default function SettingsPage({ section }: SettingsPageProps) {
const loadCache = async () => {
setCacheStatus(null)
setCacheLoading(true)
try {
const baseUrl = getApiBase()
const response = await authFetch(
@@ -689,6 +691,8 @@ export default function SettingsPage({ section }: SettingsPageProps) {
? err.message.replace(/^\\{\"detail\":\"|\"\\}$/g, '')
: 'Could not load cache.'
setCacheStatus(message)
} finally {
setCacheLoading(false)
}
}
@@ -1378,8 +1382,15 @@ export default function SettingsPage({ section }: SettingsPageProps) {
<option value={200}>200</option>
</select>
</label>
<button type="button" onClick={loadCache}>
Load saved requests
<button type="button" onClick={loadCache} disabled={cacheLoading}>
{cacheLoading ? (
<>
<span className="spinner button-spinner" aria-hidden="true" />
Loading saved requests
</>
) : (
'Load saved requests'
)}
</button>
</div>
</div>