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

작품 찜하기 - 낙관적 업데이트(home, view, auction/id 페이지) #301

Merged
merged 20 commits into from
Feb 8, 2023

Conversation

guesung
Copy link
Contributor

@guesung guesung commented Feb 7, 2023

🧑‍💻 PR 내용

  1. 낙관적 업데이트를 구현하였습니다.
    스크린샷 2023-02-07 오후 5 14 38
    QueryKey 객체를 만들어, auction/home/home-view페이지에 따라 old값을 다르게 리턴하여 낙관적 업데이트를 구현해주었습니다.

  2. 검색 후, 같은 컴포넌트여서 이전 버튼을 누를 경우 홈으로 가지는 현상이 발생하여, 검색 페이지 안에서 페이지를 구분해주었습니다.

@guesung guesung self-assigned this Feb 7, 2023
@netlify
Copy link

netlify bot commented Feb 7, 2023

Deploy Preview for attiess ready!

Name Link
🔨 Latest commit f169424
🔍 Latest deploy log https://app.netlify.com/sites/attiess/deploys/63e26321ca6b65000713053f
😎 Deploy Preview https://deploy-preview-301--attiess.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -13,7 +13,7 @@ rounded-lg hover:ring-1 hover:ring-blue-500 cursor-pointer relative

export default function WishCard({ wish }) {
const router = useRouter();
const { mutate: deletePrefer } = useDeletePrefer(wish?.id);
const { mutate: deletePrefer } = useDeletePrefer(wish?.id, '/wish');
Copy link
Contributor

Choose a reason for hiding this comment

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

query key에 path가 추가되는 이유가 무엇인가요?

Copy link
Contributor

Choose a reason for hiding this comment

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

아 페이지마다 onMutate에서 바꿔줘야 하는 키가 다르군요..

const { mutate: postPrefer } = usePostPrefer(artWork?.id!);
const { mutate: deletePrefer } = useDeletePrefer(artWork?.id!);
const { mutate: postPrefer } = usePostPrefer(artWork?.id!, '/auction');
const { mutate: deletePrefer } = useDeletePrefer(artWork?.id!, '/auction');
Copy link
Contributor

Choose a reason for hiding this comment

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

여기 ! 연산자를 일부러 뺐는데 어차피 enabled에 isNaN으로 확인이 되서 ts-error 따로 안 나면 ! 생략해도 될거 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

!제거하니까 빨간 밑줄 뜨네요 ㅜ

Copy link
Contributor

Choose a reason for hiding this comment

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

그러면 해당 페이지에서 새로고침해도 정상적으로 작동하는지 확인 부탁드려요!

alt="profile"
priority
/>
<Image src={data?.image} fill alt="profile" priority />
Copy link
Contributor

Choose a reason for hiding this comment

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

className='object-cover' 추가하면 사진 원본 가로세로 상관없이 딱 맞을거 같습니다!

Copy link
Contributor Author

@guesung guesung Feb 7, 2023

Choose a reason for hiding this comment

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

fill

스크린샷 2023-02-07 오후 6 53 38

object-cover

스크린샷 2023-02-07 오후 6 53 12

fill도 같은 기능이라서 둘을 비교해봤는데, 미세하게 다르더라구요
NEXTjs에서 제공하는 fill이 더 화질 안깨지는 것 같아요 !

Copy link
Contributor

Choose a reason for hiding this comment

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

제가 알기로는 Image에서 fill 속성 지정 이후에 추가로 object-cover 또는 object-contain과 같은 css propertiy로 추가로 조정하는거라 화질에 차이는 없는걸로 알고 있습니다. 만약 가로 세로 비율이 다른 사진인 경우 상위 엘리먼트 크기에 꽉 차지 않을 수 있어서요.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아하 추가로 지정하는 거였군요
감사합니다 😄
반영했습니다 !!

Copy link
Contributor

@GeonwooShin GeonwooShin left a comment

Choose a reason for hiding this comment

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

와 이런방법으로도 사용할 수 있네요 참고하셨던 블로그같은거 있으면 공유해주시면 감사하겠습니다!👍👍 고생하셨어요👍👍

const components = [
{ page: 'Intro', component: 'IntroComponent' },
{ page: 'Result', component: 'StepOneComponent' },
];
Copy link
Contributor

Choose a reason for hiding this comment

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

이 컴포넌트들은 언제 사용되는건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

저 코드는 필요 없을 것 같네요 제거할게요 !

@guesung guesung merged commit 3924b3f into dev Feb 8, 2023
@guesung guesung deleted the feature/add-positive-update branch February 8, 2023 01:04
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.

홈 , 전시회 작품 찜 낙관적 업데이트로 수정 및 누른뒤 화면 반영 안되는 오류
3 participants