-
Notifications
You must be signed in to change notification settings - Fork 4
๐ ์ต๊ทผ 5๊ฐ ์ด์ ์์ (#405-#409) #411
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough
Estimated code review effort๐ฏ 3 (Moderate) | โฑ๏ธ ~30 minutes Suggested reviewers
๐ฅ Pre-merge checks | โ 5โ Passed checks (5 passed)
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings. โจ Finishing touches
๐งช Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
๐ค Fix all issues with AI agents
In `@apps/web/src/apis/community/deletePost.ts`:
- Around line 20-34: The revalidation call in revalidateCommunityPage currently
awaits fetch but doesn't check HTTP status, so 4xx/5xx responses silently
succeed; update revalidateCommunityPage to capture the fetch response, check
response.ok, and if false log or throw an error including response.status and
response.statusText (or response.text()) so failed ISR revalidations are
visible; ensure this handling occurs after the fetch and before returning from
revalidateCommunityPage.
In `@apps/web/src/apis/community/patchUpdatePost.ts`:
- Around line 19-33: The fetch in revalidateCommunityPage currently treats all
HTTP responses as success; update the function to check the Response.ok after
the await fetch (in revalidateCommunityPage) and handle non-ok responses by
throwing or logging a descriptive error (include response.status and response
text) so the existing try/catch can surface failures; ensure the
Authorization/header/body logic remains unchanged and that failures end up
logged or rethrown for callers to observe.
๐งน Nitpick comments (2)
apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.ts (2)
109-113: 2. handleModalClose์์์ ์ค๋ณต ์ด๊ธฐํ
handleModalCloseํจ์์์reset()๊ณผsetImagePreview(null)์ ์ง์ ํธ์ถํ๊ณ ์์ต๋๋ค. ๊ทธ๋ฌ๋ Line 66-69์useEffect๊ฐisOpen์ดfalse๊ฐ ๋ ๋ ์ด๋ฏธ ๋์ผํ ์ด๊ธฐํ๋ฅผ ์ํํฉ๋๋ค.
handleClose()๊ฐ ๋ด๋ถ์ ์ผ๋กisOpen์false๋ก ์ค์ ํ๋ค๋ฉด, ์ฌ๊ธฐ์์reset()๊ณผsetImagePreview(null)ํธ์ถ์ ์ค๋ณต๋ฉ๋๋ค. ์ฝ๋ ์ผ๊ด์ฑ์ ์ํด ์ ๋ฆฌ๋ฅผ ๊ณ ๋ คํด ๋ณด์ธ์.โป๏ธ ๊ฐ์ํ ์ ์
const handleModalClose = () => { handleClose(); - reset(); - setImagePreview(null); };
88-106: โ ์ข์ ๋ณ๊ฒฝ์ ๋๋ค. ์๋ฌ ์ฒ๋ฆฌ๊ฐ mutation ํ ์ ์ ๊ตฌํ๋์ด ์์ต๋๋ค.
usePostAddArticle๊ณผusePutModifyArticleํ ์ ํ์ธํ ๊ฒฐ๊ณผ, ๋ ํ ๋ชจ๋onError์ฝ๋ฐฑ์์ toast๋ฅผ ํตํ ์๋ฌ ํผ๋๋ฐฑ์ ์ด๋ฏธ ์ฒ๋ฆฌํ๊ณ ์์ต๋๋ค. Mutation ์ฑ๊ณต ์์๋ง ๋ชจ๋ฌ์ ๋ซ๊ณ ํผ์ ๋ฆฌ์ ํ๋๋ก ๊ฐ์ ํ์ ๋ถ๋ถ๋ PR ๋ชฉํ์ ๋ง๊ฒ ์ ๊ตฌํ๋์์ต๋๋ค.๋ค๋ง ํ๋์ ์ต์ ํ ์ ์ ์ ์ํฉ๋๋ค:
- ์ค๋ณต reset() ์ ๊ฑฐ ์ ์
onSuccess์์reset()ํธ์ถ ํhandleClose()๊ฐisOpen์false๋ก ๋ณ๊ฒฝํ๋ฉด, useEffect (line 52-69)๊ฐ ๋ค์reset()์ ํธ์ถํฉ๋๋ค.- ๋์์๋ ๋ฌธ์ ์์ผ๋, useEffect๊ฐ ์ด๋ฏธ ๋ชจ๋ฌ ๋ซํ ๋ ์ํ ์ด๊ธฐํ๋ฅผ ๋ด๋นํ๋ฏ๋ก ๋ถํ์ํ ์ค๋ณต์ ๋๋ค.
โป๏ธ ๊ฐ์ ๋ฐฉ์
putModifyArticle( { body: data, articleId }, { onSuccess: () => { handleClose(); - reset(); }, } ); } else { postAddArticle(data, { onSuccess: () => { handleClose(); - reset(); }, }); }
| const revalidateCommunityPage = async (boardCode: string, accessToken: string) => { | ||
| try { | ||
| if (!accessToken) { | ||
| console.warn("Revalidation skipped: No access token available"); | ||
| return; | ||
| } | ||
|
|
||
| await fetch("/api/revalidate", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: `Bearer ${accessToken}`, | ||
| }, | ||
| body: JSON.stringify({ boardCode }), | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ISR revalidate๊ฐ โ์กฐ์ฉํ ์คํจโํ ์ ์์ด์.
fetch๋ 4xx/5xx์์๋ ์์ธ๋ฅผ ๋์ง์ง ์์์, ํ์ฌ๋ ์คํจ๊ฐ ๋ก๊ทธ ์์ด ํต๊ณผ๋ ์ ์์ต๋๋ค. ์๋ต ok ์ฒดํฌ๋ฅผ ์ถ๊ฐํด ์ฃผ์ธ์.
๐ง ์์ ์ ์
- await fetch("/api/revalidate", {
+ const response = await fetch("/api/revalidate", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
},
body: JSON.stringify({ boardCode }),
});
+ if (!response.ok) {
+ throw new Error(`Revalidate failed: ${response.status}`);
+ }๐ค Prompt for AI Agents
In `@apps/web/src/apis/community/deletePost.ts` around lines 20 - 34, The
revalidation call in revalidateCommunityPage currently awaits fetch but doesn't
check HTTP status, so 4xx/5xx responses silently succeed; update
revalidateCommunityPage to capture the fetch response, check response.ok, and if
false log or throw an error including response.status and response.statusText
(or response.text()) so failed ISR revalidations are visible; ensure this
handling occurs after the fetch and before returning from
revalidateCommunityPage.
| const revalidateCommunityPage = async (boardCode: string, accessToken: string) => { | ||
| try { | ||
| if (!accessToken) { | ||
| console.warn("Revalidation skipped: No access token available"); | ||
| return; | ||
| } | ||
|
|
||
| await fetch("/api/revalidate", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: `Bearer ${accessToken}`, | ||
| }, | ||
| body: JSON.stringify({ boardCode }), | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ฌ๊ธฐ๋ revalidate ์คํจ๊ฐ ์จ๊ฒจ์ง ์ ์์ด์.
fetch๋ 4xx/5xx์์๋ ์ฑ๊ณต์ผ๋ก resolve๋๋ฏ๋ก, ์๋ต ok ์ฒดํฌ๋ก ์คํจ๋ฅผ ๋ช
์ํด ์ฃผ์ธ์.
๐ง ์์ ์ ์
- await fetch("/api/revalidate", {
+ const response = await fetch("/api/revalidate", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
},
body: JSON.stringify({ boardCode }),
});
+ if (!response.ok) {
+ throw new Error(`Revalidate failed: ${response.status}`);
+ }๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const revalidateCommunityPage = async (boardCode: string, accessToken: string) => { | |
| try { | |
| if (!accessToken) { | |
| console.warn("Revalidation skipped: No access token available"); | |
| return; | |
| } | |
| await fetch("/api/revalidate", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| Authorization: `Bearer ${accessToken}`, | |
| }, | |
| body: JSON.stringify({ boardCode }), | |
| }); | |
| const revalidateCommunityPage = async (boardCode: string, accessToken: string) => { | |
| try { | |
| if (!accessToken) { | |
| console.warn("Revalidation skipped: No access token available"); | |
| return; | |
| } | |
| const response = await fetch("/api/revalidate", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| Authorization: `Bearer ${accessToken}`, | |
| }, | |
| body: JSON.stringify({ boardCode }), | |
| }); | |
| if (!response.ok) { | |
| throw new Error(`Revalidate failed: ${response.status}`); | |
| } |
๐ค Prompt for AI Agents
In `@apps/web/src/apis/community/patchUpdatePost.ts` around lines 19 - 33, The
fetch in revalidateCommunityPage currently treats all HTTP responses as success;
update the function to check the Response.ok after the await fetch (in
revalidateCommunityPage) and handle non-ok responses by throwing or logging a
descriptive error (include response.status and response text) so the existing
try/catch can surface failures; ensure the Authorization/header/body logic
remains unchanged and that failures end up logged or rethrown for callers to
observe.
์์ฝ
์ต๊ทผ ์ ๊ธฐ๋ 5๊ฐ์ ๋ฒ๊ทธ ์ด์๋ฅผ ์์ฐจ์ ์ผ๋ก ์์ ํ๊ณ , ์ฝ๋ ๋ฆฌ๋ทฐ ํผ๋๋ฐฑ์ ๋ฐ์ํ์ฌ ์ฌ์ฉ์ ๊ฒฝํ์ ๊ฐ์ ํ์ต๋๋ค.
์์ ๋ด์ญ
โจ #409: ๋ฉํฐ ์ ์ฒญํ๊ธฐ โ ๋ฉํ ๋ง ์ ์ฒญํ๊ธฐ ํ ์คํธ ๋ณ๊ฒฝ
apps/web/src/components/mentor/MentorCard/index.tsx๐จ #408: ํฉ๊ฒฉ ๋ ์ํผ ์ ์ฅ ๋ฒ๊ทธ ์์ ๋ฐ ํ ์คํธ ์์ ๊ฐ์
passTipํ๋๋ฅผmyMentorProfile์์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ก๋ํ๋๋ก ์์ apps/web/src/types/mentor.tsapps/web/src/app/mentor/modify/_ui/ModifyContent/_hooks/useModifyHookForm.tsapps/web/src/app/mentor/modify/_ui/ModifyContent/index.tsx๐พ #407: ๋ฉํ ์ํฐํด ์ ์ฅ ๊ฐ์
z.union์ฌ์ฉ)apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.tsapps/web/src/components/mentor/ArticleBottomSheetModal/lib/schema.ts๐ #406: ๋ฉํ ๋๊ธฐ ํ์ด์ง UI ๊ฐ์
p-4โ ์ ๊ฑฐ)apps/web/src/app/mentor/waiting/_ui/WaitingContent/index.tsx๐ #405: ์ปค๋ฎค๋ํฐ ํ์ด์ง ISR Revalidate ์ถ๊ฐ
apps/web/src/apis/community/patchUpdatePost.tsapps/web/src/apis/community/deletePost.tsapps/web/src/app/community/[boardCode]/[postId]/modify/PostModifyForm.tsxapps/web/src/app/community/[boardCode]/[postId]/KebabMenu.tsx์ฝ๋ ๋ฆฌ๋ทฐ ๋ฐ์ ์ฌํญ
๐ ํผ ์ ํจ์ฑ ๊ฒ์ฌ ๊ฐ์
๐ ์ง๋ฌธ ํ ๊ธ ๊ธฐ๋ฅ ๊ฐ์
โณ ๋๊ธฐ UI ํ ์คํธ ๋ฐ ์นด์ดํธ ๊ฐ์
๐ฑ๏ธ ์ ๋ ฅ ์ค ์ธ๋ถ ํด๋ฆญ ์ฒ๋ฆฌ
๐ maxLength ์์ฑ ์ถ๊ฐ
๐ฃ Hook ๋ฐํ๊ฐ ์ต์ ํ
๊ฒ์ฆ
๊ด๋ จ ์ด์
Closes #405, Closes #406, Closes #407, Closes #408, Closes #409