fix: guard against null msgInput before addEventListener in chat page

If msgInput element is somehow null, addEventListener throws and prevents
loadConvs() from being called — wrapping in null check makes it safe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-27 19:38:22 -05:00
co-authored by Claude Sonnet 4.6
parent 446cf640e8
commit 33869a6622
+6 -4
View File
@@ -2116,10 +2116,12 @@ function formatDate(d) {
// ─── Auto-resize textarea ────────────────────────────────────────────────────
const msgInput = document.getElementById('msgInput');
msgInput.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
});
if (msgInput) {
msgInput.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
});
}
loadConvs();
setInterval(loadConvs, 15000);