Skip to content

Commit 94a8915

Browse files
committed
minimized function calls
Signed-off-by: Vedansh Saini <[email protected]>
1 parent f576ed8 commit 94a8915

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/scripts/scrumHelper.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ function allIncluded() {
168168
const MAX_CACHE_SIZE = 50 * 1024 * 1024; //50mb max cache
169169

170170
function saveToStorage(data, subject = null) {
171+
if(data === githubCache.data && subject === githubCache.subject) {
172+
log('Skipping cache save - no changes');
173+
return Promise.resolve(true);
174+
}
171175
const cacheData = {
172176
data: data,
173177
cacheKey: githubCache.cacheKey,
@@ -370,7 +374,7 @@ function allIncluded() {
370374
githubPrsReviewDataProccessed = {};
371375

372376
// Update subject
373-
if(!scrumSubject?.value) {
377+
if(!githubCache.subject) {
374378
scrumSubjectLoaded();
375379
}
376380
}
@@ -463,7 +467,7 @@ function allIncluded() {
463467
githubCache.subject = subject;
464468
saveToStorage(githubCache.data, subject);
465469

466-
if(scrumSubject) {
470+
if(scrumSubject && scrumSubject.value !== subject) {
467471
scrumSubject.value = subject;
468472
scrumSubject.dispatchEvent(new Event('input', { bubbles: true }));
469473
}
@@ -684,7 +688,9 @@ function allIncluded() {
684688

685689
clearInterval(intervalSubject);
686690
scrumSubject = elements.subject;
687-
scrumSubjectLoaded();
691+
if(!scrumSubject.value) {
692+
scrumSubjectLoaded();
693+
}
688694
}, 500);
689695

690696
//check for github safe writing

0 commit comments

Comments
 (0)