Skip to content

Commit

Permalink
Disable update check on localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Jul 3, 2023
1 parent b93c9cc commit fb30470
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/ra-core/src/util/useCheckForApplicationUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ import { useEvent } from './useEvent';
export const useCheckForApplicationUpdate = (
options: UseCheckForApplicationUpdateOptions
) => {
const shouldDisable =
process.env.NODE_ENV !== 'production' ||
// Some automation tools may trigger security warnings when the app tries to download itself
// so we disable the feature when running on localhost to still allow production builds to be tested locally
window.location.hostname === 'localhost';

const {
url = window.location.href,
checkInterval = ONE_HOUR,
onNewVersionAvailable,
updateMode = process.env.NODE_ENV === 'production'
? 'manual'
: 'disabled',
updateMode = shouldDisable ? 'disabled' : 'manual',
} = options;
const currentHash = useRef<string>();
const onCodeHasChanged = useEvent(onNewVersionAvailable);
Expand Down

0 comments on commit fb30470

Please sign in to comment.