Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Comment thread
kimminna marked this conversation as resolved.
Resolved
persist-credentials: false

- uses: pnpm/action-setup@v4

Expand All @@ -67,5 +70,17 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check affected packages
id: affected
env:
BASE_REF: ${{ github.base_ref }}
run: |
set +e
pnpm turbo query affected --base "origin/$BASE_REF" --head HEAD --exit-code
CODE=$?
set -e
echo "has_changes=$([ $CODE -eq 1 ] && echo true || echo false)" >> $GITHUB_OUTPUT
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- name: Build
if: steps.affected.outputs.has_changes == 'true'
run: pnpm build
15 changes: 11 additions & 4 deletions apps/timo-web/providers/QueryProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
"use client";

import { QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import dynamic from "next/dynamic";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이렇게 dynamic 사용하면 번들 크기 최소화할 수가 잇군요!


import { queryClient } from "@/api/query-client";

const ReactQueryDevtools =
process.env.NODE_ENV === "development"
? dynamic(() =>
import("@tanstack/react-query-devtools").then(
(m) => m.ReactQueryDevtools,
),
)
: () => null;
Comment on lines +8 to +15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Devtools는 SSR 경로에서 제외하는 편이 낫습니다.

지금 구현은 개발 환경에서만 lazy-load 되지만, next/dynamic 기본값 때문에 여전히 서버 렌더 경로에는 남습니다. 이 Provider가 apps/timo-web/app/layout.tsx에서 앱 전체를 감싸고 있어서 개발 서버의 초기 렌더마다 불필요한 모듈 평가 비용이 추가됩니다. Devtools는 디버그 UI라 SSR 이점이 없으니 ssr: false를 명시해 클라이언트 전용으로 고정하는 쪽이 더 안전합니다. Next.js next/dynamic 공식 문서도 함께 확인해 주세요.

변경 예시
 const ReactQueryDevtools =
   process.env.NODE_ENV === "development"
-    ? dynamic(() =>
-        import("`@tanstack/react-query-devtools`").then(
-          (m) => m.ReactQueryDevtools,
-        ),
-      )
+    ? dynamic(
+        () =>
+          import("`@tanstack/react-query-devtools`").then(
+            (m) => m.ReactQueryDevtools,
+          ),
+        { ssr: false },
+      )
     : () => null;

Also applies to: 25-25

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/timo-web/providers/QueryProvider.tsx` around lines 8 - 15, The
ReactQueryDevtools dynamic import in QueryProvider should be client-only, since
it is a debug UI and currently still participates in the SSR path. Update the
`dynamic(...)` usage for `ReactQueryDevtools` to explicitly disable server
rendering with `ssr: false`, keeping the existing development-only guard intact.
Use the `ReactQueryDevtools` symbol in
`apps/timo-web/providers/QueryProvider.tsx` to apply the change without
affecting the rest of the provider.


interface QueryProviderProps {
children: React.ReactNode;
}
Expand All @@ -13,9 +22,7 @@ export const QueryProvider = ({ children }: QueryProviderProps) => {
return (
<QueryClientProvider client={queryClient}>
{children}
{process.env.NODE_ENV === "development" ? (
<ReactQueryDevtools initialIsOpen={false} />
) : null}
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
);
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dev:web": "turbo run dev --filter=timo-web",
"storybook": "pnpm --filter @repo/timo-design-system storybook",
"build-storybook": "pnpm --filter @repo/timo-design-system build-storybook",
"build:storybook": "turbo run build:storybook",
"chromatic": "pnpm --filter @repo/timo-design-system chromatic",
"lint": "turbo run lint",
"lint:web": "turbo run lint --filter=timo-web",
Expand Down
1 change: 1 addition & 0 deletions packages/timo-design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"check-types": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"build:storybook": "storybook build",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

두 스크립트가 동일한 명령을 수행하고 있는데 차이가 뭔지 궁금해요~

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build:storybook은 터보레포 컨벤션에 맞게 추가한 컨벤션으로, 수정하면서 중복이 생겼네요~~~ 제거할게요!

"chromatic": "chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --only-changed --exit-zero-on-changes"
},
"devDependencies": {
Expand Down
10 changes: 9 additions & 1 deletion turbo.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turbo.json에서 ! 붙이면 특정 파일을 빌드 캐시 계산에서 제외할 수 있는지 처음 알았어요!!
이런 식으로 캐시를 조정할 수 있는 거 신기하네요 👀👍

Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@
],
"tasks": {
"build": {
"description": "Next.js 앱 빌드 및 패키지 컴파일",
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"inputs": ["$TURBO_DEFAULT$", ".env*", "!**/*.stories.{tsx,mdx}"],
Comment thread
kimminna marked this conversation as resolved.
Resolved
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**"],
"passThroughEnv": ["SENTRY_AUTH_TOKEN"]
},
"build:storybook": {
"description": "Storybook 정적 파일 빌드",
"outputs": ["storybook-static/**"]
},
"lint": {
"description": "ESLint로 코드 스타일 및 오류 검사",
"dependsOn": ["^lint"]
},
"check-types": {
"description": "TypeScript 타입 검사",
"dependsOn": ["^check-types"]
},
"dev": {
"description": "개발 서버 실행",
"cache": false,
"persistent": true
}
Expand Down
Loading