Conversation
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant useAuthStore
participant Storage
User->>useAuthStore: 상태 변경 (로그인/모달 등)
useAuthStore->>Storage: 상태 저장 (persist)
User->>useAuthStore: 페이지 새로고침/재방문
useAuthStore->>Storage: 저장된 상태 조회 (rehydrate)
Storage-->>useAuthStore: 저장된 상태 반환
useAuthStore-->>User: 복원된 상태 제공
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/app/provider/authStore.ts (1)
17-36: 로그인 초기화 버그가 올바르게 수정되었습니다.persist 미들웨어를 사용하여 인증 상태가 브라우저 스토리지에 저장되도록 구현되어, 페이지 새로고침 시 로그인 상태가 유지됩니다.
다음과 같은 개선사항을 고려해보세요:
export const useAuthStore = create<AuthStore>()( persist( set => ({ isLoggedIn: false, isModalOpen: false, openModal: () => set({ isModalOpen: true }), closeModal: () => set({ isModalOpen: false }), login: () => set({ isLoggedIn: true }), logout: () => set({ isLoggedIn: false, name: null }), name: null, setName: name => set({ name }), }), { name: 'auth-storage', + partialize: (state) => ({ + isLoggedIn: state.isLoggedIn, + name: state.name, + }), } ) );
partialize옵션을 사용하여isModalOpen같은 UI 상태는 저장하지 않는 것을 고려해보세요- 보안이 중요한 경우
sessionStorage사용을 고려해보세요:storage: createJSONStorage(() => sessionStorage)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/app/provider/authStore.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: storybook
🔇 Additional comments (1)
src/app/provider/authStore.ts (1)
2-2: 올바른 미들웨어 import입니다.Zustand의 persist 미들웨어를 올바르게 import하여 상태 지속성 기능을 추가했습니다.
persist를 적용해 로컬 스토리지에 값 저장.
Summary by CodeRabbit