Skip to content

Commit 447a5c6

Browse files
authored
Merge pull request #73 from SOPT-all/feat/tanstack-query-convention/#72
[feat/#72] tanstack-query 컨벤션 정의 및 query-key 생성
2 parents 6316308 + ac6c942 commit 447a5c6

File tree

7 files changed

+27
-2
lines changed

7 files changed

+27
-2
lines changed

src/apis/constants/query-key.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const productQueryKeys = {
2+
all: () => ["product"],
3+
item: (productId: number) => [...productQueryKeys.all(), productId],
4+
detail: (productId: number) => [
5+
...productQueryKeys.item(productId),
6+
"detail",
7+
],
8+
reviews: (productId: number) => [
9+
...productQueryKeys.item(productId),
10+
"reviews",
11+
],
12+
};
13+
14+
export const authorQueryKeys = {
15+
all: () => ["author"],
16+
item: (authorId: number) => [...authorQueryKeys.all(), authorId],
17+
detail: (authorId: number) => [...authorQueryKeys.item(authorId), "detail"],
18+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// 작가 좋아요 생성 API
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// 작품 좋아요 생성 API
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// 작가 정보 조회 API
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// 작품 정보 조회 API
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// 작품 리뷰 조회 API

src/pages/product/product-page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { lazy } from "react";
1+
import { lazy, Suspense } from "react";
22
import LazySection from "@/shared/components/lazy-section/lazy-section";
33
import ProductInfo from "./components/product-info";
44
import LoadingFallback from "@/shared/components/layout/loading-fallback";
@@ -12,7 +12,9 @@ const ProductPage = () => {
1212
return (
1313
<div>
1414
{/* ProductInfo는 첫 진입 시 바로 로드 */}
15-
<ProductInfo />
15+
<Suspense fallback={<LoadingFallback />}>
16+
<ProductInfo />
17+
</Suspense>
1618

1719
{/* 나머지 컴포넌트들은 스크롤해서 화면에 보이면 로드 */}
1820
<LazySection fallback={<LoadingFallback />}>

0 commit comments

Comments
 (0)