Skip to content

Commit

Permalink
Merge pull request #191 from Expensify/tgolen-fix-sidebarrendering
Browse files Browse the repository at this point in the history
Check every second to redraw pickers
  • Loading branch information
tgolen authored Aug 16, 2024
2 parents 09bcb06 + d919156 commit 09bea8d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#1.3.64
- Fix the sidebar not redrawing when looking at GH issues

#1.3.63
- Allow for code owners to be assigned when there is only one person assigned
- Show on the K2 dashboard if an issue has an owner, and you're not the owner
Expand Down
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "K2 for GitHub",
"version": "1.3.63",
"version": "1.3.64",
"description": "Manage your Kernel Scheduling from directly inside GitHub",

"browser_specific_settings": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "k2-extension",
"version": "1.3.63",
"version": "1.3.64",
"description": "A Chrome Extension for Kernel Schedule",
"private": true,
"scripts": {
Expand Down
24 changes: 8 additions & 16 deletions src/js/lib/pages/github/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 09bea8d

Please sign in to comment.