mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-04 20:42:39 +02:00
fix(ui): Add null check for cleanupBtn to prevent JS errors on main page
The cleanupBtn element only exists on the contact management page, not on the main chat page. This was causing JavaScript to crash with 'cannot access property addEventListener of null' error, preventing messages from loading. Added null check before attaching event listener.
This commit is contained in:
@@ -99,10 +99,13 @@ function setupEventListeners() {
|
||||
}
|
||||
});
|
||||
|
||||
// Cleanup contacts button
|
||||
document.getElementById('cleanupBtn').addEventListener('click', function() {
|
||||
cleanupContacts();
|
||||
});
|
||||
// Cleanup contacts button (only exists on contact management page)
|
||||
const cleanupBtn = document.getElementById('cleanupBtn');
|
||||
if (cleanupBtn) {
|
||||
cleanupBtn.addEventListener('click', function() {
|
||||
cleanupContacts();
|
||||
});
|
||||
}
|
||||
|
||||
// Track user scrolling
|
||||
const container = document.getElementById('messagesContainer');
|
||||
|
||||
Reference in New Issue
Block a user