Skip to content

Conversation

six-standard
Copy link
Member

@six-standard six-standard commented Feb 28, 2025

원래 발생하던 유저 캐시 충돌 문제를 해결하였습니다.

다만 해결과 동시에 쿼리캐시 초기화 로직을 로그인 페이지로 이동시켰는데, NextJS 서버 액션의 redirect 함수가 사실상의 return 역할을 하면서 promise나 콜백 함수를 붙일 수가 없더군요.
그래서 해당 문제의 해결을 위해서 그냥 로그아웃 후 로그인 페이지로 이동했을 시의 캐시 처리는 로그인 페이지에 맡기기로 했습니다..

더 좋은 방법이 있는 경우 추천해주시면 바로 반영해보겠습니다!

원래는 로그인 페이지에서 캐시 초기화를 처리하는 방식으로 구현했으나, 근본적인 문제점인 me 쿼리의 refetching을 해결해서 로그인 페이지에 있던 캐시 초기화 로직은 정리하였습니다!

Copy link

Copy link

coderabbitai bot commented Feb 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@six-standard six-standard self-assigned this Feb 28, 2025
@six-standard six-standard added the bug Something isn't working label Feb 28, 2025
@six-standard six-standard changed the title [25.02.08 / TASK-116] Modify - 캐시 충돌 문제 해결 [25.02.28 / TASK-116] Modify - 캐시 충돌 문제 해결 Mar 6, 2025
@six-standard six-standard changed the title [25.02.28 / TASK-116] Modify - 캐시 충돌 문제 해결 [25.02.28 / TASK-116,TASK-103] Modify - 캐시 충돌 문제 해결 Mar 6, 2025
Copy link

} catch (err: unknown) {
const context = err as Response;
if (location && !context.ok && context.status === 403) {
if (location && !context.ok && context.status === 401) {
Copy link
Member

Choose a reason for hiding this comment

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

일단 이걸 fix 한게 아니라 403도 넣을까요? API 쪽에서 대응개발한게 아니다 보니..

Copy link
Member

Choose a reason for hiding this comment

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

@cheonHwi 님 생각도 궁금해요!

Copy link

Choose a reason for hiding this comment

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

@cheonHwi 님 생각도 궁금해요!

403도 넣어두는 방향이 괜찮을것 같아요! API쪽도 나중에 확인해볼게요

Copy link
Member

@Nuung Nuung left a comment

Choose a reason for hiding this comment

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

좋았던 점

  • 로그아웃을 캐싱 클리어 기점 잡는거 좋았습니다! 함수 관심사 분리, utils 에 뺀것도 좋았어요
  • 401, 403 대응같이 저희가 더 디테일한 부분을 더 신경써야 겠다 싶네요!

아쉬운 점

  • utils 는 잘 아시다시피 함수가 길을 잃어버리는 경우가 많더라구요, 그에 따라 오히려 jsdocs 와 같은 도큐멘테이션이 강화되면 좋을 것 같아요.
  • 추가로 로그아웃안하고 다시 재로그인 하는 경우는 어떻게 되는지 궁금해요.

@six-standard
Copy link
Member Author

좋았던 점

  • 로그아웃을 캐싱 클리어 기점 잡는거 좋았습니다! 함수 관심사 분리, utils 에 뺀것도 좋았어요
  • 401, 403 대응같이 저희가 더 디테일한 부분을 더 신경써야 겠다 싶네요!

아쉬운 점

  • utils 는 잘 아시다시피 함수가 길을 잃어버리는 경우가 많더라구요, 그에 따라 오히려 jsdocs 와 같은 도큐멘테이션이 강화되면 좋을 것 같아요.
  • 추가로 로그아웃안하고 다시 재로그인 하는 경우는 어떻게 되는지 궁금해요.

로그아웃되지 않은 상태에서 재로그인 하는 경우면, 토큰이 만료된게 아닌 상황이라면 그냥 로그인될 것으로 보입니다!

Copy link

@Jihyun3478 Jihyun3478 left a comment

Choose a reason for hiding this comment

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

좋았던 점

  • 캐싱 충돌 문제를 해결하는 과정과 방법을 엿볼 수 있어서 좋았습니다!
  • utils 클래스를 활용해 특정 비즈니스 로직에 의존하지 않는 범용적인 코드를 구현하신 부분이 좋았습니다👍

Copy link

@cheonHwi cheonHwi left a comment

Choose a reason for hiding this comment

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

로그아웃 시점에 캐시를 없애는 부분 괜찮은 방법 같네요!
캐시 처리 로직을 따로 Util 함수로 분리한 것도 앞으로 로직이 변경될 때 좋게 작용할 것 같아요!

@six-standard six-standard merged commit 2827add into dev Mar 8, 2025
1 check passed
@six-standard six-standard deleted the modify/cache-error-fix branch March 9, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants