Skip to content

Commit

Permalink
Merge branch 'master' into last-visited-debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 authored Nov 1, 2023
2 parents ea51700 + d8eadf6 commit 3936cf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/components/Header/Tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { ReduxState } from '../../redux/store';
import BellIcon from '@patternfly/react-icons/dist/dynamic/icons/bell-icon';
import { toggleNotificationsDrawer } from '../../redux/actions';
import useWindowWidth from '../../hooks/useWindowWidth';
import { usePreviewFlag } from '../../utils/usePreviewFlag';

const isITLessEnv = ITLess();

Expand Down Expand Up @@ -81,7 +80,7 @@ const Tools = () => {
isRhosakEntitled: false,
isDemoAcc: false,
});
const enableIntegrations = usePreviewFlag('platform.sources.integrations');
const enableIntegrations = useFlag('platform.sources.integrations');
const { xs } = useWindowWidth();
const user = useSelector(({ chrome: { user } }: ReduxState) => user!);
const unreadNotifications = useSelector(({ chrome: { notifications } }: ReduxState) => notifications.data.some((item) => !item.read));
Expand Down
18 changes: 9 additions & 9 deletions src/components/Routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ChromeRoute from '../ChromeRoute';
import NotFoundRoute from '../NotFoundRoute';
import LoadingFallback from '../../utils/loading-fallback';
import { ReduxState } from '../../redux/store';
import { usePreviewFlag } from '../../utils/usePreviewFlag';
import { useFlag } from '@unleash/proxy-client-react';

const INTEGRATION_SOURCES = 'platform.sources.integrations';

Expand All @@ -23,15 +23,15 @@ const redirects = [
{
path: '/settings',
to: '/settings/integrations',
previewFlag: {
featureFlag: {
value: true,
name: INTEGRATION_SOURCES,
},
},
{
path: '/settings',
to: '/settings/sources',
previewFlag: {
featureFlag: {
value: false,
name: INTEGRATION_SOURCES,
},
Expand Down Expand Up @@ -67,8 +67,8 @@ export type RoutesProps = {
};

const ChromeRoutes = ({ routesProps }: RoutesProps) => {
const enableIntegrations = usePreviewFlag(INTEGRATION_SOURCES);
const previewFlags = useMemo<Record<string, boolean>>(() => ({ INTEGRATION_SOURCES: enableIntegrations }), [enableIntegrations]);
const enableIntegrations = useFlag(INTEGRATION_SOURCES);
const featureFlags = useMemo<Record<string, boolean>>(() => ({ INTEGRATION_SOURCES: enableIntegrations }), [enableIntegrations]);
const moduleRoutes = useSelector(({ chrome: { moduleRoutes } }: ReduxState) => moduleRoutes);
const showBundleCatalog = localStorage.getItem('chrome:experimental:quickstarts') === 'true';

Expand All @@ -84,10 +84,10 @@ const ChromeRoutes = ({ routesProps }: RoutesProps) => {
}
/>
)}
{redirects.map(({ path, to, previewFlag }) => {
if (previewFlag) {
const found = Object.keys(previewFlags).find((item) => item === previewFlag.name);
if (previewFlags[found as string] !== previewFlag.value) {
{redirects.map(({ path, to, featureFlag }) => {
if (featureFlag) {
const found = Object.keys(featureFlags).find((item) => item === featureFlag.name);
if (featureFlags[found as string] !== featureFlag.value) {
return null;
}
}
Expand Down

0 comments on commit 3936cf4

Please sign in to comment.