Actions
Bug #191
opentaskList initializing twice
Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
06/03/2026
Due date:
% Done:
0%
Estimated time:
Engineering Effort:
App Component:
Webapp
Feature:
Tasks
Description
In task_list.js I register event listeners like this:
init() {
// Alpine's $dispatch bubbles to window, not document
if (!this.eventListenersAdded) {
window.addEventListener('task-created', (e) => this.onTaskCreated(e));
window.addEventListener('task-updated', (e) => this.onTaskUpdated(e));
window.addEventListener('task-deleted', (e) => this.onTaskDeleted(e));
window.addEventListener('tasks-search', (e) => this.onTasksSearch(e));
this.eventListenersAdded = true;
// Log initial tasks
console.log('Initial tasks:', this.tasks);
}
},
I have to wrap it in a poorman's singleton because if I don't, the "initial tasks" console log statement occurs twice, which means the event listeners are added twice, and in turn the console log fills with errors when I create a task. There are probably many other consequences but the fact of the matter is that if I don't protect the event listeners then they get added multiple times.
The mock singleton does work, but it's unclear what other consequences come from this thing getting initialized twice.
I should probably investigate further, but this stub issue could point in the right direction if future UI/webapp problems indicate a problem in this area.
Updated by Sam Pearson 23 days ago
- App Component set to Webapp
- Feature set to Tasks
Actions