Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds S3/AWS environment variables and docs; updates Next.js headers to disable caching for auth API routes; replaces client-side logout navigation with full-page redirects; removes legacy markdown editor components, updates multiple import paths, and bumps/removes related package deps. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (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.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
next.config.ts (1)
52-74:⚠️ Potential issue | 🔴 CriticalAuth cache-control header will be overridden by the catch-all rule.
In Next.js, when multiple
headers()rules match the same path, all matching headers are applied. For/api/auth/:path*, both the auth-specific rule (line 52–61) and the catch-all rule (line 62–74) match. Since they set the sameCache-Controlkey, the later rule (line 62–74) takes precedence, overriding yourno-storedirective with public caching that allows 1-hour CDN caching.This causes auth endpoints to be cached at the Vercel Edge Network, risking stale auth state.
Reorder the rules so the auth-specific rule comes after the catch-all, or exclude auth routes from the catch-all using a
hasormissingcondition to prevent the override.
🤖 Fix all issues with AI agents
In @.env.example:
- Line 38: The .env.example file is missing a trailing newline after the last
entry (NEXT_PUBLIC_S3_BUCKET=); add a single newline character at EOF so the
file ends with a blank line (no extra whitespace or characters) to satisfy
dotenv-linter and POSIX conventions.
In `@src/components/modules/dashboard/nav-user.tsx`:
- Around line 115-125: The toast.success call in LogoutItem.handleLogout runs
immediately before the hard redirect (window.location.href = "/"), which
prevents the toast from being visible; update handleLogout to either remove the
toast or delay the redirect so the toast can render (e.g., show
toast.success(...) then perform the redirect inside a short setTimeout or use
the SPA router navigation instead of window.location.href). Locate LogoutItem
and its async handleLogout function (which calls authClient.signOut,
toast.success, and window.location.href) and implement the chosen approach so
the toast is visible before navigation.
In `@src/components/modules/profile/user-nav.tsx`:
- Around line 126-137: The LogoutItem component’s handleLogout calls
toast.success and immediately forces a hard redirect, causing the toast to be
cut off; change the flow in LogoutItem (and the other nav LogoutItem in
nav-user.tsx) to wait briefly or await a toast display before setting
window.location.href, and refactor the duplicated logic into a shared useLogout
hook or utility (export a useLogout or logoutUser function that performs
authClient.signOut, handles toast.error/toast.success and the delayed redirect)
then import and call that from both LogoutItem components to remove duplication.
| AWS_ENDPOINT_URL_S3= | ||
| AWS_ENDPOINT_URL_IAM= | ||
| AWS_REGION= | ||
| NEXT_PUBLIC_S3_BUCKET= No newline at end of file |
There was a problem hiding this comment.
Add a trailing newline at end of file.
Static analysis (dotenv-linter) flags the missing blank line at EOF. Most tools and POSIX conventions expect a trailing newline.
NEXT_PUBLIC_S3_BUCKET=
+📝 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.
| NEXT_PUBLIC_S3_BUCKET= | |
| NEXT_PUBLIC_S3_BUCKET= | |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 38-38: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
🤖 Prompt for AI Agents
In @.env.example at line 38, The .env.example file is missing a trailing newline
after the last entry (NEXT_PUBLIC_S3_BUCKET=); add a single newline character at
EOF so the file ends with a blank line (no extra whitespace or characters) to
satisfy dotenv-linter and POSIX conventions.
| function LogoutItem() { | ||
| const router = useRouter(); | ||
|
|
||
| async function handleLogout() { | ||
| const { error } = await authClient.signOut(); | ||
|
|
||
| if (error) { | ||
| toast.error(error.message || "Something went wrong"); | ||
| } else { | ||
| toast.success("Logged out successfully"); | ||
| router.push("/"); | ||
| router.refresh(); | ||
| window.location.href = "/"; | ||
| } | ||
| } |
There was a problem hiding this comment.
Toast may not be visible before the hard redirect.
toast.success(...) on line 122 fires right before window.location.href = "/" on line 123. The full-page navigation will likely destroy the DOM before the toast renders or becomes readable. Consider either removing the toast or deferring the redirect briefly.
Option: small delay before redirect
} else {
toast.success("Logged out successfully");
- window.location.href = "/";
+ setTimeout(() => {
+ window.location.href = "/";
+ }, 300);
}📝 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.
| function LogoutItem() { | |
| const router = useRouter(); | |
| async function handleLogout() { | |
| const { error } = await authClient.signOut(); | |
| if (error) { | |
| toast.error(error.message || "Something went wrong"); | |
| } else { | |
| toast.success("Logged out successfully"); | |
| router.push("/"); | |
| router.refresh(); | |
| window.location.href = "/"; | |
| } | |
| } | |
| function LogoutItem() { | |
| async function handleLogout() { | |
| const { error } = await authClient.signOut(); | |
| if (error) { | |
| toast.error(error.message || "Something went wrong"); | |
| } else { | |
| toast.success("Logged out successfully"); | |
| setTimeout(() => { | |
| window.location.href = "/"; | |
| }, 300); | |
| } | |
| } |
🤖 Prompt for AI Agents
In `@src/components/modules/dashboard/nav-user.tsx` around lines 115 - 125, The
toast.success call in LogoutItem.handleLogout runs immediately before the hard
redirect (window.location.href = "/"), which prevents the toast from being
visible; update handleLogout to either remove the toast or delay the redirect so
the toast can render (e.g., show toast.success(...) then perform the redirect
inside a short setTimeout or use the SPA router navigation instead of
window.location.href). Locate LogoutItem and its async handleLogout function
(which calls authClient.signOut, toast.success, and window.location.href) and
implement the chosen approach so the toast is visible before navigation.
| function LogoutItem() { | ||
| const router = useRouter(); | ||
|
|
||
| async function handleLogout() { | ||
| const { error } = await authClient.signOut(); | ||
|
|
||
| if (error) { | ||
| toast.error(error.message || "Something went wrong"); | ||
| } else { | ||
| toast.success("Logged out successfully"); | ||
| router.push("/"); | ||
| router.refresh(); | ||
| // Hard redirect to fully clear Router Cache + stale auth state | ||
| window.location.href = "/"; | ||
| } | ||
| } |
There was a problem hiding this comment.
Same toast-before-redirect issue as in nav-user.tsx; also consider extracting shared logout logic.
The same toast visibility concern applies here. Additionally, both LogoutItem components (here and in nav-user.tsx) share identical handleLogout logic. Consider extracting a shared useLogout hook or utility to avoid duplication.
🤖 Prompt for AI Agents
In `@src/components/modules/profile/user-nav.tsx` around lines 126 - 137, The
LogoutItem component’s handleLogout calls toast.success and immediately forces a
hard redirect, causing the toast to be cut off; change the flow in LogoutItem
(and the other nav LogoutItem in nav-user.tsx) to wait briefly or await a toast
display before setting window.location.href, and refactor the duplicated logic
into a shared useLogout hook or utility (export a useLogout or logoutUser
function that performs authClient.signOut, handles toast.error/toast.success and
the delayed redirect) then import and call that from both LogoutItem components
to remove duplication.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/editor/markdown/markdown-preview.tsx (1)
22-22:⚠️ Potential issue | 🟡 MinorTypo:
break-workds→break-words.Pre-existing typo in the CSS class name on this line. Worth fixing while you're touching this file.
Proposed fix
- <section className="markdown break-workds grid"> + <section className="markdown break-words grid">
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores / Refactor