hotfix: keep initial telephony rows on first empty refresh
This commit is contained in:
parent
b1a4342a9a
commit
415abb058a
13
RELEASE_NOTES_v2.2.86.md
Normal file
13
RELEASE_NOTES_v2.2.86.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Release Notes v2.2.86
|
||||||
|
|
||||||
|
Dato: 2026-05-04
|
||||||
|
|
||||||
|
## Hotfix
|
||||||
|
|
||||||
|
- Rettet Telefoni UI race-condition hvor server-renderede kald blev vist ved page load, men kunne blive overskrevet med tom liste efter ca. 1 sekund af foerste JS-refresh.
|
||||||
|
- Siden bevarer nu initialt viste kald, hvis foerste API-refresh uden aktive filtre returnerer tomt.
|
||||||
|
|
||||||
|
## Berorte filer
|
||||||
|
|
||||||
|
- `app/modules/telefoni/templates/log.html`
|
||||||
|
- `VERSION`
|
||||||
@ -58,7 +58,7 @@
|
|||||||
<th class="text-end">Varighed</th>
|
<th class="text-end">Varighed</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="telefoniRows">
|
<tbody id="telefoniRows" data-initial-count="{{ initial_calls|length if initial_calls else 0 }}">
|
||||||
{% if initial_calls and initial_calls|length > 0 %}
|
{% if initial_calls and initial_calls|length > 0 %}
|
||||||
{% for r in initial_calls %}
|
{% for r in initial_calls %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -213,6 +213,7 @@ function escapeHtml(str) {
|
|||||||
|
|
||||||
let telefoniCurrentUserId = null;
|
let telefoniCurrentUserId = null;
|
||||||
let telefoniAutoResetTried = false;
|
let telefoniAutoResetTried = false;
|
||||||
|
let telefoniFirstApiLoadDone = false;
|
||||||
const telefoniCallMap = new Map();
|
const telefoniCallMap = new Map();
|
||||||
const linkSagState = {
|
const linkSagState = {
|
||||||
callId: null,
|
callId: null,
|
||||||
@ -857,6 +858,8 @@ async function loadUsers() {
|
|||||||
|
|
||||||
async function loadCalls() {
|
async function loadCalls() {
|
||||||
const tbody = document.getElementById('telefoniRows');
|
const tbody = document.getElementById('telefoniRows');
|
||||||
|
const initialCount = Number(tbody?.dataset?.initialCount || '0');
|
||||||
|
const hadServerRows = Number.isFinite(initialCount) && initialCount > 0;
|
||||||
tbody.innerHTML = '<tr><td colspan="7" class="text-muted small"><span class="spinner-border spinner-border-sm me-2"></span>Indlæser...</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="7" class="text-muted small"><span class="spinner-border spinner-border-sm me-2"></span>Indlæser...</td></tr>';
|
||||||
|
|
||||||
const userId = document.getElementById('filterUser').value;
|
const userId = document.getElementById('filterUser').value;
|
||||||
@ -882,6 +885,13 @@ async function loadCalls() {
|
|||||||
(rows || []).forEach(r => telefoniCallMap.set(Number(r.id), r));
|
(rows || []).forEach(r => telefoniCallMap.set(Number(r.id), r));
|
||||||
if (!rows || rows.length === 0) {
|
if (!rows || rows.length === 0) {
|
||||||
const hadFilters = Boolean(userId || from || to || withoutCase);
|
const hadFilters = Boolean(userId || from || to || withoutCase);
|
||||||
|
|
||||||
|
// If SSR already showed calls, avoid replacing them with an empty first auto-refresh.
|
||||||
|
if (!telefoniFirstApiLoadDone && hadServerRows && !hadFilters) {
|
||||||
|
telefoniFirstApiLoadDone = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hadFilters && !telefoniAutoResetTried) {
|
if (hadFilters && !telefoniAutoResetTried) {
|
||||||
telefoniAutoResetTried = true;
|
telefoniAutoResetTried = true;
|
||||||
document.getElementById('filterUser').value = '';
|
document.getElementById('filterUser').value = '';
|
||||||
@ -892,10 +902,12 @@ async function loadCalls() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tbody.innerHTML = '<tr><td colspan="7" class="text-muted small">Ingen opkald fundet</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="7" class="text-muted small">Ingen opkald fundet</td></tr>';
|
||||||
|
telefoniFirstApiLoadDone = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
telefoniAutoResetTried = false;
|
telefoniAutoResetTried = false;
|
||||||
|
telefoniFirstApiLoadDone = true;
|
||||||
|
|
||||||
tbody.innerHTML = rows.map(r => {
|
tbody.innerHTML = rows.map(r => {
|
||||||
const started = r.started_at ? new Date(r.started_at) : null;
|
const started = r.started_at ? new Date(r.started_at) : null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user