fix(telefoni): skip initial auto-refresh when SSR rows exist

This commit is contained in:
Christian 2026-05-18 07:07:51 +02:00
parent 94f6735ed5
commit 071d926781

View File

@ -1064,7 +1064,8 @@ async function unlinkCase(callId) {
}
document.addEventListener('DOMContentLoaded', async () => {
cacheInitialSsrRows(document.getElementById('telefoniRows'));
const telefoniRows = document.getElementById('telefoniRows');
cacheInitialSsrRows(telefoniRows);
initLinkContactModalEvents();
initLinkSagModalEvents();
const userFilter = document.getElementById('filterUser');
@ -1083,6 +1084,14 @@ document.addEventListener('DOMContentLoaded', async () => {
document.getElementById('filterFrom').addEventListener('change', loadCalls);
document.getElementById('filterTo').addEventListener('change', loadCalls);
document.getElementById('filterWithoutCase').addEventListener('change', loadCalls);
// Keep SSR rows on first paint when they exist; avoid replacing visible data
// with an empty state due to transient API/auth/cache issues in production.
if (hasExistingCallRows(telefoniRows)) {
console.warn('Telefoni: springer initial auto-refresh over, SSR-rækker vises');
return;
}
await loadCalls({ preserveOnEmpty: true, skipLoadingState: true });
});
</script>