Skip to content

fix: 로그인 초기화 버그 수정#159

Merged
hyeeuncho merged 1 commit intodevelopfrom
fix/#158/login-bug-fix
Jun 1, 2025
Merged

fix: 로그인 초기화 버그 수정#159
hyeeuncho merged 1 commit intodevelopfrom
fix/#158/login-bug-fix

Conversation

@hyeeuncho
Copy link
Copy Markdown
Member

@hyeeuncho hyeeuncho commented Jun 1, 2025

persist를 적용해 로컬 스토리지에 값 저장.

Summary by CodeRabbit

  • New Features
    • 로그인 상태, 사용자 이름, 모달 상태가 페이지 새로고침이나 세션이 종료되어도 유지됩니다.

@hyeeuncho hyeeuncho linked an issue Jun 1, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 1, 2025

Walkthrough

useAuthStore Zustand 스토어에 persist 미들웨어가 추가되어, 인증 상태와 모달 상태 등이 브라우저 스토리지에 저장 및 복원되도록 변경되었습니다. 스토어의 상태 구조와 API는 그대로이며, 저장 키는 'auth-storage'로 설정되었습니다.

Changes

파일/경로 변경 요약
src/app/provider/authStore.ts Zustand 스토어에 persist 미들웨어 추가, 상태의 영속성 지원

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant useAuthStore
    participant Storage

    User->>useAuthStore: 상태 변경 (로그인/모달 등)
    useAuthStore->>Storage: 상태 저장 (persist)
    User->>useAuthStore: 페이지 새로고침/재방문
    useAuthStore->>Storage: 저장된 상태 조회 (rehydrate)
    Storage-->>useAuthStore: 저장된 상태 반환
    useAuthStore-->>User: 복원된 상태 제공
Loading

Possibly related PRs

Poem

🐰
로그인 정보, 이제는 저장!
새로고침해도 걱정 없어
작은 토끼, 로그인 기억해
모달 열고 닫는 것도
브라우저 안에 쏙쏙!
영속성의 마법,
오늘도 개발은 즐거워!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hyeeuncho hyeeuncho requested a review from Yejiin21 June 1, 2025 04:04
@hyeeuncho hyeeuncho self-assigned this Jun 1, 2025
@hyeeuncho hyeeuncho added the 🛠️ BugFix 오류 해결 과정 기록 label Jun 1, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 1, 2025

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 18363fa and 78ee89b.

📒 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하여 상태 지속성 기능을 추가했습니다.

@hyeeuncho hyeeuncho merged commit b3193b9 into develop Jun 1, 2025
2 checks passed
@hyeeuncho hyeeuncho deleted the fix/#158/login-bug-fix branch June 1, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ BugFix 오류 해결 과정 기록

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] 새로고침 시 로그인 상태 초기화되는 문제 수정

2 participants