perf(tv): avoid unnecessary UI updates when TV show count unchanged
This commit is contained in:
@@ -9,6 +9,7 @@ let lastValue = 0;
|
||||
let zeroTimer = null;
|
||||
|
||||
export async function refreshTvShowCount() {
|
||||
const prevValue = lastValue;
|
||||
const ticket = ++requestSeq;
|
||||
try {
|
||||
const resp = await apiFetch("/api/tvshows");
|
||||
@@ -37,7 +38,10 @@ export async function refreshTvShowCount() {
|
||||
lastValue = 0;
|
||||
tvShowCount.set(0);
|
||||
}
|
||||
// Sadece sayım gerçekten değiştiyse UI yenilemeyi tetikle
|
||||
if (nextVal !== prevValue) {
|
||||
tvShowRefreshVersion.update((v) => v + 1);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("⚠️ TV show count güncellenemedi:", err?.message || err);
|
||||
// Hata durumunda mevcut değeri koru, titreşimi önle
|
||||
|
||||
Reference in New Issue
Block a user