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:
co-authored by
Claude Sonnet 4.6
parent
446cf640e8
commit
33869a6622
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user