Skip to content

Commit

Permalink
fix(home-page): remove redundant getAuthenticatedUser query (datahub-…
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-radhakrishnan authored and cccs-Dustin committed Feb 1, 2023
1 parent 882d1a2 commit 50d5623
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions datahub-web-react/src/app/home/HomePageBody.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { CorpUser } from '../../types.generated';
import { useGetAuthenticatedUser } from '../useGetAuthenticatedUser';
import { HomePageRecommendations } from './HomePageRecommendations';

Expand All @@ -17,10 +18,6 @@ const BodyContainer = styled.div`
`;

export const HomePageBody = () => {
const authenticatedUserUrn = useGetAuthenticatedUser()?.corpUser?.urn;
return (
<BodyContainer>
{authenticatedUserUrn && <HomePageRecommendations userUrn={authenticatedUserUrn} />}
</BodyContainer>
);
const user: CorpUser = useGetAuthenticatedUser()?.corpUser as CorpUser;
return <BodyContainer>{user && <HomePageRecommendations user={user} />}</BodyContainer>;
};
8 changes: 4 additions & 4 deletions datahub-web-react/src/app/home/HomePageRecommendations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from 'styled-components/macro';
import { Button, Divider, Empty, Typography } from 'antd';
import { RocketOutlined } from '@ant-design/icons';
import {
CorpUser,
EntityType,
RecommendationModule as RecommendationModuleType,
RecommendationRenderType,
Expand All @@ -15,7 +16,6 @@ import { useEntityRegistry } from '../useEntityRegistry';
import { useGetEntityCountsQuery } from '../../graphql/app.generated';
import { GettingStartedModal } from './GettingStartedModal';
import { ANTD_GRAY } from '../entity/shared/constants';
import { useGetAuthenticatedUser } from '../useGetAuthenticatedUser';
import { HomePagePosts } from './HomePagePosts';

const RecommendationsContainer = styled.div`
Expand Down Expand Up @@ -72,7 +72,7 @@ const DomainsRecomendationContainer = styled.div`
`;

type Props = {
userUrn: string;
user: CorpUser;
};

const simpleViewEntityTypes = [
Expand All @@ -83,12 +83,12 @@ const simpleViewEntityTypes = [
EntityType.GlossaryTerm,
];

export const HomePageRecommendations = ({ userUrn }: Props) => {
export const HomePageRecommendations = ({ user }: Props) => {
// Entity Types
const entityRegistry = useEntityRegistry();
const browseEntityList = entityRegistry.getBrowseEntityTypes();
const [showGettingStartedModal, setShowGettingStartedModal] = useState(false);
const user = useGetAuthenticatedUser()?.corpUser;
const userUrn = user?.urn;

const showSimplifiedHomepage = user?.settings?.appearance?.showSimplifiedHomepage;

Expand Down

0 comments on commit 50d5623

Please sign in to comment.