Skip to content

Commit

Permalink
Merge pull request #1419 from ita-social-projects/feature/issue-cache…
Browse files Browse the repository at this point in the history
…-control

fix check statement
  • Loading branch information
sashapanasiuk5 authored Sep 16, 2024
2 parents deb2a67 + fcca472 commit 157cb69
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 157cb69

Please sign in to comment.