Skip to content

[Fix/sidebar-240] ๐Ÿšจ Fix : SSR + React Query ํ•˜์ด๋“œ๋ ˆ์ด์…˜ ๋ฒ”์œ„ ์ˆ˜์ •#241

Merged
goodaseul merged 2 commits into
devfrom
fix/sidebar-240
Jan 1, 2026
Merged

[Fix/sidebar-240] ๐Ÿšจ Fix : SSR + React Query ํ•˜์ด๋“œ๋ ˆ์ด์…˜ ๋ฒ”์œ„ ์ˆ˜์ •#241
goodaseul merged 2 commits into
devfrom
fix/sidebar-240

Conversation

@swallowedB

Copy link
Copy Markdown
Collaborator

์š”์•ฝ

  • ๋ณ€๊ฒฝ ๋ชฉ์ (์™œ?)

    • React Query ํ•˜์ด๋“œ๋ ˆ์ด์…˜ ๋ฒ”์œ„๊ฐ€ ํŽ˜์ด์ง€(GoalsPage)์—๋งŒ ์ ์šฉ๋˜์–ด,
      ๋ ˆ์ด์•„์›ƒ((protected) layout)์— ์œ„์น˜ํ•œ ๋„ค๋น„๊ฒŒ์ด์…˜์—์„œ goals ์บ์‹œ๋ฅผ ์ „๋‹ฌ๋ฐ›์ง€ ๋ชปํ•˜๋˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ
    • ๋™์ผํ•œ goals ์ฟผ๋ฆฌ๋ฅผ layout๊ณผ page์—์„œ ์ค‘๋ณต prefetch/hydration ํ•˜๋˜ ๊ตฌ์กฐ๋ฅผ ์ •๋ฆฌํ•˜์—ฌ,
      SSR ๋‹จ๊ณ„์—์„œ์˜ ๋ถˆํ•„์š”ํ•œ ์ค‘๋ณต ์š”์ฒญ๊ณผ ์ธ์ฆ ๊ด€๋ จ ์—๋Ÿฌ(Unauthenticated) ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์„ ์ œ๊ฑฐ
  • ์ฃผ์š” ๋ณ€๊ฒฝ(๋ฌด์—‡์„?)

    • goals ์ฟผ๋ฆฌ์˜ prefetch + HydrationBoundary๋ฅผ (protected) layout ๋ ˆ๋ฒจ๋กœ ์ด๋™
    • ๋„ค๋น„๊ฒŒ์ด์…˜(NavigationDesktop / NavigationGoalSection)์ด ํ•˜์ด๋“œ๋ ˆ์ด์…˜๋œ goals ์บ์‹œ๋ฅผ ๊ณต์œ ํ•˜๋„๋ก ์ˆ˜์ •
    • GoalsPage์—์„œ goals ์ค‘๋ณต prefetch ์ œ๊ฑฐ, ํŽ˜์ด์ง€ ์ „์šฉ ๋ฐ์ดํ„ฐ(todos)๋งŒ ์œ ์ง€

๋ณ€๊ฒฝ ๋‚ด์šฉ

  • (protected) layout์—์„œ goals ์ฟผ๋ฆฌ prefetch ๋ฐ HydrationBoundary ์ ์šฉ
  • ๋„ค๋น„๊ฒŒ์ด์…˜ ์˜์—ญ์—์„œ goals ์บ์‹œ๋ฅผ SSR ํ•˜์ด๋“œ๋ ˆ์ด์…˜์œผ๋กœ ๊ณต์œ 
  • GoalsPage์—์„œ goalsQueryKeys.list() ์ค‘๋ณต prefetch ์ œ๊ฑฐ
  • ํŽ˜์ด์ง€ ๋‹จ์—์„œ๋Š” todos ๋“ฑ ํŽ˜์ด์ง€ ์ „์šฉ ์ฟผ๋ฆฌ๋งŒ prefetch/hydration ์œ ์ง€

๋ฐฐ๊ฒฝ ์„ค๋ช…

๊ธฐ์กด ๊ตฌ์กฐ์—์„œ๋Š”:

  • GoalsPage์—๋งŒ HydrationBoundary๊ฐ€ ์กด์žฌ
  • ๋„ค๋น„๊ฒŒ์ด์…˜์€ layout ํ•˜์œ„์— ์œ„์น˜ํ•˜์—ฌ ํ•ด๋‹น boundary ๋ฒ”์œ„ ๋ฐ–์— ์žˆ์Œ
  • ๊ทธ ๊ฒฐ๊ณผ ๋„ค๋น„๊ฒŒ์ด์…˜์˜ useGoalList()๊ฐ€ ์บ์‹œ ์—†์ด ์‹คํ–‰๋˜๋ฉฐ,
    SSR ๋‹จ๊ณ„์—์„œ ํด๋ผ์ด์–ธํŠธ ์ „์šฉ fetcher๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ
  • ํ† ํฐ ๋งŒ๋ฃŒ ์ƒํƒœ์—์„œ ์ดˆ๊ธฐ ์ง„์ž… ์‹œ Unauthenticated ์—๋Ÿฌ๊ฐ€ ๋…ธ์ถœ๋  ์ˆ˜ ์žˆ์—ˆ์Œ

๊ฐœ์„  ํ›„์—๋Š”:

  • layout์—์„œ goals๋ฅผ ๋‹จ์ผ ์†Œ์Šค๋กœ prefetch/hydration
  • ๋„ค๋น„๊ฒŒ์ด์…˜๊ณผ ํŽ˜์ด์ง€๊ฐ€ ๋™์ผํ•œ goals ์บ์‹œ๋ฅผ ๊ณต์œ 
  • ์„œ๋ฒ„ = backendFetch / ํด๋ผ์ด์–ธํŠธ = fetcher ๋ถ„๋ฆฌ ์›์น™ ์œ ์ง€
  • SSR ๋‹จ๊ณ„์—์„œ ๋ถˆํ•„์š”ํ•œ fetcher ์‹คํ–‰ ๋ฐฉ์ง€

๊ด€๋ จ ์ด์Šˆ

close #240

@vercel

vercel Bot commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
slice Ready Ready Preview, Comment Jan 1, 2026 0:20am

@goodaseul goodaseul merged commit 1fa7db2 into dev Jan 1, 2026
3 checks passed
@goodaseul goodaseul deleted the fix/sidebar-240 branch January 1, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

๐Ÿšจ Fix : ์‚ฌ์ด๋“œ๋ฐ” ๊ด€๋ จ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

2 participants