Skip to content

Commit 8e2feeb

Browse files
fix (firefox): reported error message
on firefox, whenever we were navigating away from the main page, it would trigger the error handling code that would show the message: "Service unavailable, if the problem persist, contact your administrator" before the page change. This is only hapenning in Firefox but as a precautionary measure we're trying to detect those cases upfront so we wait instead of triggering the error handling
1 parent a1d1e95 commit 8e2feeb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

public/assets/lib/ajax.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ export default function(opts) {
3333
}
3434
return res;
3535
}),
36-
rxjs.catchError((err) => rxjs.throwError(processError(err.xhr, err))),
36+
rxjs.catchError(
37+
(err) => activePage
38+
? rxjs.throwError(processError(err.xhr, err))
39+
: rxjs.EMPTY
40+
),
3741
);
3842
}
3943

44+
let activePage = true;
45+
window.addEventListener("beforeunload", function() {
46+
activePage = false;
47+
});
48+
4049
function parseDataUrl(url) {
4150
const matches = url.match(/^data:(.*?)(;base64)?,(.*)$/);
4251
if (!matches) throw new Error("Invalid Data URL");

0 commit comments

Comments
 (0)