Skip to content

Commit

Permalink
fix check statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sashapanasiuk5 committed Sep 16, 2024
1 parent 6503f23 commit 058604c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/common/components/withClearCache.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-extra-boolean-cast */
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-underscore-dangle */
import { useEffect, useState } from 'react';
Expand All @@ -20,13 +21,15 @@ const WithClearCache: React.FC<{ children: React.ReactNode }> = ({ children }) =
useEffect(() => {
const localVersion = localStorage.getItem('VERSION');
const envVersion = window._env_.VERSION;
if (typeof envVersion !== 'undefined') {
if (!!envVersion) {
const isVersionMatches = localVersion === envVersion;
setIsLatestBuildDate(isVersionMatches);
if (!isVersionMatches) {
localStorage.setItem('VERSION', envVersion);
refreshCacheAndReload();
}
} else {
refreshCacheAndReload();
}
}, [isLatestBuildDate]);

Expand Down

0 comments on commit 058604c

Please sign in to comment.