Skip to content

fix(wds): next-themes hydration 이슈로 인한 scriptProps 설정#535

Merged
Sh031224 merged 1 commit intomainfrom
fix/theme-provider-script-props
Apr 9, 2026
Merged

fix(wds): next-themes hydration 이슈로 인한 scriptProps 설정#535
Sh031224 merged 1 commit intomainfrom
fix/theme-provider-script-props

Conversation

@Sh031224
Copy link
Copy Markdown
Collaborator

@Sh031224 Sh031224 commented Apr 9, 2026

Summary

  • ThemeProvider에서 next-themes가 주입하는 inline script로 인해 발생하는 hydration/CSP 이슈 대응
  • 서버 사이드에서는 scriptProps를 전달하지 않고, 클라이언트에서는 type: 'application/json'으로 설정

Reference

Test plan

  • light/dark 테마 전환 시 FOUC 없이 정상 동작 확인
  • SSR 환경에서 hydration 에러 없이 렌더링되는지 확인
  • 기존 ThemeProvider 사용처 회귀 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 테마 제공자 동작을 개선하여 서버 렌더링 환경에서의 호환성 강화

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 01aa4ddc-156c-43ce-8397-cf565c01099d

📥 Commits

Reviewing files that changed from the base of the PR and between 980fcd4 and 2fc69b6.

📒 Files selected for processing (1)
  • packages/wds/src/theme-provider/index.tsx

Walkthrough

ThemeProvider 컴포넌트에 scriptProps 값을 추가했습니다. 이 값은 SSR 중에는 undefined이고 브라우저에서는 { type: 'application/json' }으로 설정되어 NextThemeProvider에 전달됩니다.

Changes

Cohort / File(s) Summary
Theme Provider Props
packages/wds/src/theme-provider/index.tsx
scriptProps 상태 변수를 추가했습니다. SSR 환경에서는 undefined, 브라우저 환경에서는 { type: 'application/json' }으로 조건부 설정하여 NextThemeProviderscriptProps prop으로 전달합니다.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 PR의 주요 변경사항인 next-themes 하이드레이션 이슈 해결을 위한 scriptProps 설정을 명확하게 요약하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/theme-provider-script-props

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

size-limit report 📦

Path Size
wds 2.37 KB (0%)
wds-icon 5 KB (0%)
wds-lottie 83 B (0%)
wds-theme 144 B (0%)
wds-engine 332 B (0%)
wds-nextjs 165 B (0%)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🚀 Preview

Last commit8f6539c
Preview URLhttps://dev-montage.wanted.co.kr/8f6539c

@Sh031224 Sh031224 merged commit fd4cdb6 into main Apr 9, 2026
11 checks passed
@Sh031224 Sh031224 deleted the fix/theme-provider-script-props branch April 9, 2026 00:53
@Sh031224 Sh031224 added this to the 3.4.5 milestone Apr 9, 2026
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.

2 participants