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

Only get map infos if user is logged in #204

Merged
merged 6 commits into from
Jul 21, 2024
Merged
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
7 changes: 5 additions & 2 deletions app/pages/maps/[mapUId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useState } from 'react';
import React, { useContext, useMemo, useState } from 'react';
import { Layout } from 'antd';
import { useRouter } from 'next/router';

Expand Down Expand Up @@ -27,6 +27,7 @@ import {
import SectorTimeTableButton from '../../../components/maps/SectorTimeTableButton';
import { filterReplaysWithValidSectorTimes } from '../../../lib/replays/sectorTimes';
import useViewerPerformancePopupConfirmations from '../../../lib/hooks/useViewerPerformancePopupConfirmations';
import { AuthContext } from '../../../lib/contexts/AuthContext';

const Home = (): JSX.Element => {
const queryClient = useQueryClient();
Expand All @@ -47,7 +48,9 @@ const Home = (): JSX.Element => {
isFetching: isFetchingReplays,
} = useMapReplays(mapUId);

const { data: mapInfo } = useMapInfo(mapUId);
const { user } = useContext(AuthContext);
const mapInfoQueryKey = user ? mapUId : undefined;
const { data: mapInfo } = useMapInfo(mapInfoQueryKey);

const selectedReplaysWithValidSectors = useMemo(
() => filterReplaysWithValidSectorTimes(selectedReplayData, mapReplaysResult?.replays || []),
Expand Down
Loading