Skip to content

Commit

Permalink
fix: prevent adding extra compares from same tab
Browse files Browse the repository at this point in the history
Signed-off-by: Alan D. Tse <alandtse@gmail.com>
  • Loading branch information
alandtse committed Oct 5, 2019
1 parent 1c8a585 commit 4887441
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ function handleMessage(request, sender, sendResponse) {
licensesLoaded < list.licenses.length + list.exceptions.length
) {
pendingcompare = true;
comparequeue.push({ selection: selection, tabId: activeTabId });
var priorIndex = comparequeue.findIndex(item => {
return item.tabId === activeTabId;
});
if (comparequeue.length > 0 && priorIndex > -1) {
comparequeue[priorIndex] = {
selection: selection,
tabId: activeTabId
};
} else comparequeue.push({ selection: selection, tabId: activeTabId });
status[activeTabId] = "Pending";
if (updating) {
console.log(
Expand Down

0 comments on commit 4887441

Please sign in to comment.