fix: xREL Cache-Logik sauber – Suchen lädt frisch, Reload zeigt Cache, Aktualisieren refresht
This commit is contained in:
@@ -467,23 +467,25 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
||||
api(`/tools/media/movie/${tmdbId}`)
|
||||
.then(d => { setDetail(d); setLoading(false); })
|
||||
.catch(e => { setError(e.message); setLoading(false); });
|
||||
// Gecachte Releases laden – ohne refresh, nur befüllte Einträge
|
||||
api(`/tools/media/movie/${tmdbId}/xrel`)
|
||||
.then(d => { if (d.xrel?.length > 0) { setXrel(d.xrel); onHasXrel?.(tmdbId); } })
|
||||
.catch(() => {});
|
||||
const prev = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
return () => { document.body.style.overflow = prev; };
|
||||
}, [tmdbId]);
|
||||
|
||||
const searchXrel = async () => {
|
||||
const searchXrel = async (forceRefresh = false) => {
|
||||
if (!detail) return;
|
||||
setXrelLoading(true);
|
||||
try {
|
||||
// Immer refresh=1: ignoriert leere Cache-Einträge, sucht frisch
|
||||
// Befüllte Cache-Einträge werden trotzdem sofort zurückgegeben (Backend-Logik)
|
||||
const params = new URLSearchParams({
|
||||
title: detail.title || '',
|
||||
orig: detail.original_title || '',
|
||||
imdb_id: detail.imdb_id || '',
|
||||
refresh: '1',
|
||||
});
|
||||
if (forceRefresh) params.set('refresh', '1');
|
||||
const d = await api(`/tools/media/movie/${tmdbId}/xrel?${params}`);
|
||||
setXrel(d.xrel || []);
|
||||
if (d.has_xrel) onHasXrel?.(tmdbId);
|
||||
@@ -629,7 +631,7 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
||||
<div style={{ display:'flex', alignItems:'center', gap:8, marginBottom: xrel?.length ? 8 : 0 }}>
|
||||
<div style={{ ...S.head, marginBottom:0, flex:1 }}>RELEASES (XREL.TO)</div>
|
||||
<button
|
||||
onClick={() => searchXrel()}
|
||||
onClick={() => searchXrel(xrel !== null && xrel.length > 0)}
|
||||
disabled={xrelLoading}
|
||||
style={{
|
||||
fontSize:10, fontFamily:'monospace', cursor: xrelLoading ? 'default' : 'pointer',
|
||||
|
||||
Reference in New Issue
Block a user