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

새로고침 시에도 추가 질문 유지 #168

Merged
merged 12 commits into from
May 26, 2023
Merged

Conversation

sumi-0011
Copy link
Member

🤔 해결하려는 문제가 무엇인가요?

�새로고침 시에도 추가 질문 유지

🎉 변경 사항

  • 커스텀 질문을 추가하면, 로컬스토리지 상태를 업데이트 합니다.
  • useLocalStorage 훅을 사용하였어요.
  • useLocalStorage 훅에서 hydration 오류가 발생해, 해결하였습니다.

@sumi-0011 sumi-0011 added the feat New feature or request label May 26, 2023
@github-actions
Copy link

Bundle Sizes

Compared against be296b6

Route: No significant changes found

Dynamic import: No significant changes found

Copy link
Member

@hyesungoh hyesungoh 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 40 to 50
const [hasMounted, setHasMounted] = useState(false);

useEffect(() => {
setHasMounted(true);
}, []);

if (hasMounted) {
return [storedValue, setValue] as const;
}

return [initialValue, setValue] as const;
Copy link
Member

@hyesungoh hyesungoh May 26, 2023

Choose a reason for hiding this comment

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

Suggested change
const [hasMounted, setHasMounted] = useState(false);
useEffect(() => {
setHasMounted(true);
}, []);
if (hasMounted) {
return [storedValue, setValue] as const;
}
return [initialValue, setValue] as const;
const isMounted = useRef(false);
useDidMount(() => {
isMounted.current = true;
});
if (isMounted.current) {
return [storedValue, setValue] as const;
}
return [initialValue, setValue] as const;

이렇게 useRefuseDidMount를 사용하면 어떨까요??

Copy link
Member Author

Choose a reason for hiding this comment

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

오 좋습니다! 감사합니다 ㅎㅎ

@codecov-commenter
Copy link

codecov-commenter commented May 26, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.13 🎉

Comparison is base (be296b6) 92.39% compared to head (957387e) 92.52%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #168      +/-   ##
==========================================
+ Coverage   92.39%   92.52%   +0.13%     
==========================================
  Files          38       38              
  Lines         276      281       +5     
  Branches       51       52       +1     
==========================================
+ Hits          255      260       +5     
  Misses         21       21              
Impacted Files Coverage Δ
src/hooks/storage/useLocalStorage.ts 81.81% <100.00%> (+5.34%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@cloudflare-pages
Copy link

cloudflare-pages bot commented May 26, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 957387e
Status: ✅  Deploy successful!
Preview URL: https://759cb68a.na-lab.pages.dev
Branch Preview URL: https://feat-create-dialog.na-lab.pages.dev

View logs

@sumi-0011 sumi-0011 merged commit 98215d6 into main May 26, 2023
14 of 15 checks passed
@sumi-0011 sumi-0011 deleted the feat/create-dialog branch May 26, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants