Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(home-page): remove redundant getAuthenticatedUser query #6464

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) => {
jjoyce0510 marked this conversation as resolved.
Show resolved Hide resolved
// 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