summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/header.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/header.js')
-rw-r--r--app/assets/javascripts/header.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/assets/javascripts/header.js b/app/assets/javascripts/header.js
index d151cecf5be..3f9163e924d 100644
--- a/app/assets/javascripts/header.js
+++ b/app/assets/javascripts/header.js
@@ -16,10 +16,11 @@ import Tracking from '~/tracking';
*/
export default function initTodoToggle() {
$(document).on('todo:toggle', (e, count) => {
+ const updatedCount = count || e?.detail?.count || 0;
const $todoPendingCount = $('.todos-count');
- $todoPendingCount.text(highCountTrim(count));
- $todoPendingCount.toggleClass('hidden', count === 0);
+ $todoPendingCount.text(highCountTrim(updatedCount));
+ $todoPendingCount.toggleClass('hidden', updatedCount === 0);
});
}