diff --git a/mockup.html b/mockup.html
index a41a996..ff808d2 100644
--- a/mockup.html
+++ b/mockup.html
@@ -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; }
})();