Skip to content

Commit 1c6cef5

Browse files
committed
Fix messages being cleared erroneously (resolves #51)
1 parent 1033af1 commit 1c6cef5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

website/src/queries-init.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ const UF_MSG_API_RATE = "<b>GitHub API rate-limits exceeded.</b> Consider pr
1818
+ "It's also possible that the queried repository has so many forks that it's impossible to scan it completely without running out of API calls.<br>"
1919
+ ":(";
2020

21+
// list of messages which should not be cleared when the request ends
22+
const UF_PRESERVED_MSGS = [
23+
UF_MSG_NO_FORKS,
24+
UF_MSG_EMPTY_FILTER,
25+
UF_MSG_ERROR,
26+
UF_MSG_SLOWER,
27+
UF_MSG_API_RATE
28+
];
29+
2130

2231
const EXAMPLE_LINK_1 = `<a href="${buildAutoQueryURL('payne911/PieMenu')}"
2332
onclick="ga_shortExampleLink();">payne911/PieMenu</a>`;
@@ -92,8 +101,8 @@ function clearMsg() {
92101
JQ_ID_MSG.empty();
93102
}
94103
function clearNonErrorMsg() {
95-
const errorMsg = JQ_ID_MSG.html();
96-
if (errorMsg !== UF_MSG_ERROR && errorMsg !== UF_MSG_SLOWER)
104+
const msg = JQ_ID_MSG.html();
105+
if (!UF_PRESERVED_MSGS.includes(msg))
97106
clearMsg();
98107
}
99108
function setHeader(msg) {

website/src/queries-logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function allRequestsAreDone() {
104104
function decrementCounters() {
105105
ONGOING_REQUESTS_COUNTER--;
106106
if (allRequestsAreDone()) {
107-
clearMsg();
107+
clearNonErrorMsg();
108108
sortTable();
109109
enableQueryFields();
110110
displayCsvExportBtn();

0 commit comments

Comments
 (0)