Skip to content

Commit 1d104c1

Browse files
committed
fix: keep pending quota entries refreshable
1 parent 8804b13 commit 1d104c1

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/quota/QuotaCard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export function QuotaCard<TState extends QuotaStatusState>({
118118
);
119119
const idleMessageKey = onRefresh ? `${i18nPrefix}.idle` : (cardIdleMessageKey ?? `${i18nPrefix}.idle`);
120120
const cacheStatus = quota?.cacheStatus;
121+
const showPendingCacheAsIdle = quotaStatus === 'loading' && cacheStatus === 'pending';
121122
const cacheStatusLabel = cacheStatus ? t(`quota_management.cache_status_${cacheStatus}`) : null;
122123
const lastRefreshLabel = quota?.lastRefreshAt ? formatQuotaResetTime(quota.lastRefreshAt) : null;
123124
const quotaRecoverLabel = quota?.quotaRecoverAt ? formatQuotaResetTime(quota.quotaRecoverAt) : null;
@@ -147,9 +148,9 @@ export function QuotaCard<TState extends QuotaStatusState>({
147148
</div>
148149

149150
<div className={styles.quotaSection}>
150-
{quotaStatus === 'loading' ? (
151+
{quotaStatus === 'loading' && !showPendingCacheAsIdle ? (
151152
<div className={styles.quotaMessage}>{t(`${i18nPrefix}.loading`)}</div>
152-
) : quotaStatus === 'idle' ? (
153+
) : quotaStatus === 'idle' || showPendingCacheAsIdle ? (
153154
onRefresh ? (
154155
<button
155156
type="button"

src/components/quota/QuotaSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ export function QuotaSection<TState extends QuotaStatusState, TData>({
212212
const refreshQuotaForFile = useCallback(
213213
async (file: AuthFileItem) => {
214214
if (disabled || file.disabled) return;
215-
if (quota[file.name]?.status === 'loading') return;
215+
const currentQuota = quota[file.name];
216+
if (currentQuota?.status === 'loading' && currentQuota.cacheStatus !== 'pending') return;
216217

217218
try {
218219
await loadQuota([file], 'page', setLoading);

0 commit comments

Comments
 (0)