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
10 changes: 10 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions fundamentals/today-i-learned/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"es-toolkit": "^1.41.0",
"lucide-react": "^0.525.0",
"overlay-kit": "^1.8.4",
"react": "^18.2.0",
Expand Down
10 changes: 4 additions & 6 deletions fundamentals/today-i-learned/src/api/hooks/useDiscussions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useAuth } from "@/contexts/AuthContext";
import { ENV_CONFIG } from "@/utils/env";
import {
useInfiniteQuery,
useSuspenseQuery,
useMutation,
useQuery,
useQueryClient
Expand Down Expand Up @@ -122,12 +123,11 @@ export function useInfiniteDiscussions({
export function useWeeklyTopDiscussions({
owner = ENV_CONFIG.GITHUB_OWNER,
repo = ENV_CONFIG.GITHUB_REPO,
limit,
enabled = true
limit
}: Omit<UseDiscussionsParams, "categoryName"> & { limit?: number } = {}) {
const { user } = useAuth();

return useQuery({
return useSuspenseQuery({
queryKey: DISCUSSIONS_QUERY_KEYS.weekly(),
queryFn: async () => {
const discussions = await fetchWeeklyTopDiscussions({
Expand All @@ -137,7 +137,6 @@ export function useWeeklyTopDiscussions({
});
return limit ? discussions.slice(0, limit) : discussions;
},
enabled,
staleTime: 1000 * 60 * 30, // 30분
gcTime: 1000 * 60 * 60, // 1시간
retry: 1
Expand Down Expand Up @@ -240,14 +239,13 @@ export function useMyContributions({
export function useDiscussionDetail(id: string) {
const { user } = useAuth();

return useQuery({
return useSuspenseQuery({
queryKey: DISCUSSIONS_QUERY_KEYS.detail(id),
queryFn: () =>
fetchDiscussionDetail({
id,
accessToken: user?.accessToken
}),
enabled: !!id,
staleTime: 1000 * 60 * 5, // 5분
gcTime: 1000 * 60 * 30, // 30분
retry: 2
Expand Down
Loading