diff --git a/frontend/src/tools/codeschnipsel.jsx b/frontend/src/tools/codeschnipsel.jsx index c17a01c..94f5a73 100644 --- a/frontend/src/tools/codeschnipsel.jsx +++ b/frontend/src/tools/codeschnipsel.jsx @@ -148,7 +148,10 @@ function HistoryModal({ snippet, onClose, onRestore, toast }) { const isMob = window.innerWidth < 768; const getOlderCode = (h) => { const idx = history.indexOf(h); - return idx < history.length-1 ? history[idx+1].code : null; + // Newest history entry (idx=0) compares against CURRENT snippet code + if (idx === 0) return snippet.code; + // Older entries compare against the next newer history entry + return history[idx - 1].code; }; return (
{getLangLabel(selected.language)} · {fmtDt(selected.saved_at)} - {showDiff && getOlderCode(selected)===null && (älteste Version)} + {history.indexOf(selected) === history.length-1 && (älteste Version)} - {!snippet.is_shared && ( + {!snippet.is_shared && selected.code !== snippet.code && (