Skip to content

Commit

Permalink
fix: move outdated sdks check up (#6725)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Mar 28, 2024
1 parent ca6946d commit c12cb42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions frontend/src/component/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { EdgeUpgradeBanner } from './banners/EdgeUpgradeBanner/EdgeUpgradeBanner
import { LicenseBanner } from './banners/internalBanners/LicenseBanner';
import { Demo } from './demo/Demo';
import { OutdatedSdksBanner } from './banners/OutdatedSdksBanner/OutdatedSdksBanner';
import { useUiFlag } from '../hooks/useUiFlag';

const StyledContainer = styled('div')(() => ({
'& ul': {
Expand All @@ -49,6 +50,8 @@ export const App = () => {
}
}, [authDetails, user]);

const outdatedSdksBannerEnabled = useUiFlag('outdatedSdksBanner');

return (
<SWRProvider>
<Suspense fallback={<Loader />}>
Expand All @@ -68,6 +71,10 @@ export const App = () => {
<ExternalBanners />
<InternalBanners />
<EdgeUpgradeBanner />
<ConditionallyRender
condition={outdatedSdksBannerEnabled}
show={<OutdatedSdksBanner />}
/>
<OutdatedSdksBanner />
<StyledContainer>
<ToastRenderer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { Banner } from '../Banner/Banner';
import type { IBanner } from 'interfaces/banner';
import { useOutdatedSdks } from 'hooks/api/getters/useOutdatedSdks/useOutdatedSdks';
import { useUiFlag } from 'hooks/useUiFlag';
import { Link } from 'react-router-dom';
import { styled } from '@mui/material';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
Expand All @@ -13,7 +12,6 @@ export const OutdatedSdksBanner = () => {
const {
data: { sdks },
} = useOutdatedSdks();
const flagEnabled = useUiFlag('outdatedSdksBanner');
const { trackEvent } = usePlausibleTracker();

const applicationClickedWithVersion = (sdkVersion: string) => {
Expand Down Expand Up @@ -74,7 +72,7 @@ export const OutdatedSdksBanner = () => {
return (
<>
<ConditionallyRender
condition={flagEnabled && sdks.length > 0}
condition={sdks.length > 0}
show={<Banner banner={outdatedSdksBanner} />}
/>
</>
Expand Down

0 comments on commit c12cb42

Please sign in to comment.