Skip to content
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
2 changes: 1 addition & 1 deletion src/apis/instance.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import returnFetch, { FetchArgs } from 'return-fetch';
import { ENVS } from '@/constants';
import { ServerNotRespondingError } from '@/errors';

const ABORT_MS = 10000;
const ABORT_MS = 5000;

type ErrorType = {
code: string;
Expand Down
22 changes: 10 additions & 12 deletions src/app/(auth-required)/leaderboards/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@ export const Content = () => {
});

const data = useMemo(() => {
const isUserBased = searchParams.based === 'user';
const isViewBased = searchParams.sort === 'viewCount';
const isUserBased = searchParams?.based === 'user';
const isViewBased = searchParams?.sort === 'viewCount';

const value = (isUserBased ? boards?.users : boards?.posts) as LeaderboardItemType[];
const value = ((isUserBased ? boards?.users : boards?.posts) || []) as LeaderboardItemType[];

return (
value.map(({ username, title, viewDiff, likeDiff, slug }) => ({
key: isUserBased ? username : title,
username,
url: URLS.VELOG + `/@${username}` + (isUserBased ? '/posts' : `/${slug}`),
value: isViewBased ? viewDiff : likeDiff,
})) || []
);
}, [boards, searchParams.based, searchParams.sort]);
return value.map(({ username, title, viewDiff, likeDiff, slug }) => ({
key: isUserBased ? username : title,
username,
url: URLS.VELOG + `/@${username}` + (isUserBased ? '/posts' : `/${slug}`),
value: isViewBased ? viewDiff : likeDiff,
}));
}, [boards, searchParams?.based, searchParams?.sort]);

const handleChange = (param: Partial<searchParamsType>) => {
startHolyLoader();
Expand Down
2 changes: 1 addition & 1 deletion src/app/(auth-required)/main/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Content = () => {
fetchNextPage();
}, [inView]);

const joinedPosts = useMemo(() => posts?.pages.flatMap((i) => i.posts), [posts]);
const joinedPosts = useMemo(() => posts?.pages.flatMap((i) => i.posts) || [], [posts]);

return (
<div className="flex w-full h-full gap-[30px] max-MBI:flex-col max-TBL:gap-[20px] overflow-hidden">
Expand Down