fix: SyntaxError in _buildCTData (mixed quotes), _chatHistory race condition

This commit is contained in:
WASRUSGEN 2026-05-29 20:36:49 +03:00
parent 99be1f7019
commit 534ad8fdcd

View File

@ -3974,7 +3974,7 @@ window.addEventListener('DOMContentLoaded', checkReturning);
status: 'active',
quality: c.quality, // оценка качества если есть
deadlines_count: c.deadlines_count || 0,
go: "toast('📄 Открываю дело: " + name.replace(/'/g,''') + "')"
go: "_openRealCase(" + i + ")"
};
});
@ -4118,6 +4118,12 @@ window.addEventListener('DOMContentLoaded', checkReturning);
render();
};
window._openRealCase = function(i) {
var c = (_getContracts() || [])[i];
if (!c) return;
toast('📄 ' + (c.type || 'Договор') + (c.counterparty ? ' · ' + c.counterparty : ''));
};
// Рендер при открытии вкладки cases и cabinet
var _origTab2 = window.tab;
window.tab = function(id) {
@ -7289,10 +7295,13 @@ function _compressAsync(showToast) {
.catch(function(){});
}
// Флаг памяти — используется для контекстного приветствия
// Флаг памяти — используется для контекстного приветствия (с защитой от race condition)
window._hasMemory = (function() {
var h = _chatHistory.length, c = _getContracts().length;
return (h || c) ? { messages: h, contracts: c, hasDossier: !!_getDossier() } : null;
try {
var h = (typeof _chatHistory !== 'undefined' ? _chatHistory.length : 0);
var c = (typeof _getContracts === 'function' ? _getContracts().length : 0);
return (h || c) ? { messages: h, contracts: c, hasDossier: !!(typeof _getDossier === 'function' && _getDossier()) } : null;
} catch(e) { return null; }
})();
</script>
</body></html>