Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(toks-main): server component 역할 분리와 메인 Skeleton UI 추가 #390

Merged
merged 10 commits into from
Jan 14, 2024

Conversation

minsgy
Copy link
Member

@minsgy minsgy commented Jan 14, 2024

💡 왜 PR을 올렸나요?

  • server component 구조를 위해 패러렐 라우팅을 적용하여 bottomsheet + toast를 따로 관리합니다.
  • QuizList 컴포넌트에 Skeleton UI를 추가합니다.
  • react-query v5 devtools 설치
  • QA 처리
    • Categories BottomSheet Tab 초기화 안되는 이슈 fix
    • Categories BottomSheet 선택했던 탭 데이터 적용안되는 이슈 fix

💁 무엇이 어떻게 바뀌나요?

  • Skeleton UI 추가
    image

  • dev tools
    image

💬 리뷰어분들께

  • devtools에 loading + error 분기 생겨서 관리하기 좋아졌습니다.
  • QuizList Suspense로 만들어서 streaming 할 수 있게 하고 싶은데 http > uuid 의존성을 전부 담고있어서 이거 fetch 공통화 함수를 하나 만들어야할 것 같다는 생각입니다

@minsgy
Copy link
Member Author

minsgy commented Jan 14, 2024

@chaaerim 드래프트 풀면 자동머지되서 막아놨어요 cicd 수정되면 그때 풀겠습니다

@minsgy minsgy requested review from chaaerim and dengoyoon January 14, 2024 02:46
@chaaerim
Copy link
Member

@minsgy 브랜치 규칙 release에도 적용해뒀습니다~!

@minsgy minsgy marked this pull request as ready for review January 14, 2024 05:50
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2024

Codecov Report

Attention: 275 lines in your changes are missing coverage. Please review.

Comparison is base (7d2a3ba) 0.08% compared to head (393943c) 0.08%.

Files Patch % Lines
...pBarHeader)/toks-main/_components/SkeletonCard.tsx 0.00% 56 Missing ⚠️
src/common/utils/reactQuery.ts 0.00% 55 Missing ⚠️
src/common/utils/isEqual.ts 0.00% 45 Missing ⚠️
src/app/(AppBarHeader)/toks-main/@toast/page.tsx 0.00% 32 Missing ⚠️
...app/(AppBarHeader)/toks-main/@bottomSheet/page.tsx 0.00% 27 Missing ⚠️
src/app/(AppBarHeader)/toks-main/layout.tsx 0.00% 20 Missing ⚠️
src/common/components/Skeleton.tsx 0.00% 13 Missing ⚠️
...der)/toks-main/_components/CategoryBottomSheet.tsx 0.00% 9 Missing ⚠️
src/app/(AppBarHeader)/toks-main/page.tsx 0.00% 5 Missing ⚠️
src/common/providers/index.tsx 0.00% 4 Missing ⚠️
... and 5 more
Additional details and impacted files
@@                Coverage Diff                 @@
##           release/routing    #390      +/-   ##
==================================================
- Coverage             0.08%   0.08%   -0.01%     
==================================================
  Files                  164     171       +7     
  Lines                 5934    6166     +232     
  Branches               164     171       +7     
==================================================
  Hits                     5       5              
- Misses                5929    6161     +232     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@minsgy minsgy marked this pull request as draft January 14, 2024 07:29
@minsgy minsgy marked this pull request as ready for review January 14, 2024 07:43
@LineGu LineGu enabled auto-merge (squash) January 14, 2024 07:45
@minsgy minsgy disabled auto-merge January 14, 2024 07:45
Comment on lines +9 to +11
<Suspense fallback={<SkeletonCardList />}>
<CardList />
</Suspense>
Copy link
Collaborator

Choose a reason for hiding this comment

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

말씀하신 로딩 상태 처리를 그냥 이렇게 Suspense만 둘러싸면 되는걸까요?
아니면 useQuery를 통해 호출할때 변경해야 하는 부분이 있을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

useSuspenseQuery를 써주시면 될 것 같습니다~! 그거말곤 없어요

Copy link
Member

Choose a reason for hiding this comment

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

useSuspenseQuery를 써야하는 경우가 어떤 상황일까요?? react suspense같은 경우는 ui상의 로딩처리가 필요할 때 쓰는게 맞죠..??

Copy link
Member Author

@minsgy minsgy Jan 14, 2024

Choose a reason for hiding this comment

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

말씀하신거처럼 UI상 로딩처리가 필요할 때 사용 할 수있는 케이스가 맞고,
prefetch 제외하고 streaming으로 UI를 나누어서 보여줘야하는 상황이 맞을 것 같아요! @chaaerim

Copy link
Member Author

@minsgy minsgy Jan 14, 2024

Choose a reason for hiding this comment

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

참고로.. 로딩처리는 3가지로 나뉘어서 볼 수 있을것 같습니당

  1. page.tsx -> loading.tsx
  2. server suspense -> fallback
  3. react-query -> isPending

Copy link
Collaborator

Choose a reason for hiding this comment

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

이 파일에서 export해주고 있는 함수들은 우선 만들어두기만 하신건가요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

아 그리고 혹시 참고하신 레퍼런스가 있으셨는지 궁금합니다..!!

Copy link
Member Author

Choose a reason for hiding this comment

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

요거 슬랙에 올렸었는데 쓸까하다가 queryKey, queryFn 전부 분리해서 쓰더라고요..? 근데그렇게까진 오버스펙같아서 안쓰긴했습니다 https://soobing.github.io/react/next-app-router-react-query/

Comment on lines +15 to +17
{children}
{toast}
{bottomSheet}
Copy link
Collaborator

Choose a reason for hiding this comment

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

요거는 혹시 RootLayout에서 하는건 좀 별로일까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

bottomSheet는 쓰이는 페이지마다 관리해주는게 좋아보이고 toast는 쓰이는 곳 추가로 생기면 써도 좋을 것 같네요~

Copy link
Member

@chaaerim chaaerim left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~~!! 구조 참고해서 저도 리팩토링 해둘게요!! 👍

Comment on lines +9 to +11
<Suspense fallback={<SkeletonCardList />}>
<CardList />
</Suspense>
Copy link
Member

Choose a reason for hiding this comment

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

useSuspenseQuery를 써야하는 경우가 어떤 상황일까요?? react suspense같은 경우는 ui상의 로딩처리가 필요할 때 쓰는게 맞죠..??

export const Skeleton = ({ className }: Props) => {
return (
<div
className={twMerge('h-[20px] w-full rounded-[8px] bg-gray-90', className)}
Copy link
Member

Choose a reason for hiding this comment

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

clsx 말고 twMerge 사용하신 이유가 있나요!?!?!?

Copy link
Member Author

Choose a reason for hiding this comment

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

@chaaerim 요거 height/width 값 수정해야하는데 clsx를 사용하면 css가 오버라이딩되서 적용이 안됩니당

@minsgy minsgy requested review from chaaerim and dengoyoon January 14, 2024 11:36
@minsgy minsgy merged commit b21ab65 into release/routing Jan 14, 2024
3 checks passed
@minsgy minsgy deleted the refactor/toks-main branch January 14, 2024 12:22
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.

5 participants