From 4bf4869bba0e12c2c41798e236b55fb84fe16e69 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Wed, 14 Aug 2024 13:37:39 -0600 Subject: [PATCH] Check every second to redraw pickers --- src/js/lib/pages/github/issue.js | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/js/lib/pages/github/issue.js b/src/js/lib/pages/github/issue.js index d5151e67..a30f3951 100644 --- a/src/js/lib/pages/github/issue.js +++ b/src/js/lib/pages/github/issue.js @@ -153,27 +153,19 @@ export default function () { } allreadySetup = true; - let refreshPickerTimeoutID; - let refreshAssigneesTimeoutID; + // Draw them once when the page is loaded setTimeout(refreshPicker, 500); setTimeout(refreshAssignees, 500); - // Listen for when the sidebar is redrawn, then redraw our pickers - $(document).bind('DOMNodeRemoved', (e) => { - if ($(e.target).hasClass('sidebar-assignee')) { - // Make sure that only one setTimeout runs at a time - clearTimeout(refreshAssigneesTimeoutID); - refreshAssigneesTimeoutID = setTimeout(refreshAssignees, 500); + // Every second, check to see if the pickers are still there, and if not, redraw them + setInterval(() => { + if (!$('.k2picker-wrapper').length) { + refreshPicker(); } - - if ($(e.target).is('#partial-discussion-sidebar')) { - // Make sure that only one setTimeout runs at a time - clearTimeout(refreshPickerTimeoutID); - refreshPickerTimeoutID = setTimeout(refreshPicker, 500); - clearTimeout(refreshAssigneesTimeoutID); - refreshAssigneesTimeoutID = setTimeout(refreshAssignees, 500); + if (!$('.js-issue-assignees .k2-element').length) { + refreshAssignees(); } - }); + }, 1000); }; return IssuePage;