Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useWindowFocus from "use-window-focus";

let getCurrentVersion = async (endpoint: string) => {
let response = await fetch(endpoint);
if (response.status > 400) {
if (response.status >= 400) {
console.error(
"[next-deploy-notifications] Could not find current app version. Did you setup the API route?"
);
Expand All @@ -31,7 +31,7 @@ type UseHasNewDeploy = (options?: HookOptions) => HookValues;
let useHasNewDeploy: UseHasNewDeploy = (options = {}) => {
let debug = (message: string) => {
if (options.debug) {
console.log(...["[Deploy notifications] ", message]);
console.log("[Deploy notifications] ", message);
}
};

Expand All @@ -44,7 +44,7 @@ let useHasNewDeploy: UseHasNewDeploy = (options = {}) => {
let endpoint = options.endpoint ?? "/api/has-new-deploy";
let isUnknown = currentVersion === "unknown";

let loopInterval = interval < 3_000 ? interval : 3_000;
let loopInterval = interval > 3_000 ? interval : 3_000;
let loopOrNotInterval = !hasNewDeploy && windowFocused ? loopInterval : null;

useInterval(async () => {
Expand Down