fix (desktop): superset landing page Application error due to auth cookie#692
Conversation
📝 WalkthroughWalkthroughThe CTAButtons component's session initialization now includes error handling. A try/catch block safely wraps the session fetch, defaulting session to null and logging errors on failure. Conditional rendering logic and public API signatures remain unchanged. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (1)
17-53: Consider extracting the duplicated "Download for macOS" button.The "Download for macOS" button (lines 26-32 and 45-51) is duplicated in both conditional branches. Extracting it to a constant or small component would improve maintainability and reduce the risk of inconsistent updates.
♻️ Proposed refactor to eliminate duplication
export async function CTAButtons() { let session = null; try { session = await auth.api.getSession({ headers: await headers() }); } catch (error) { // Handle errors from invalid/stale cookies (e.g., old Clerk cookies after migration to Better Auth) console.error("[marketing/CTAButtons] Failed to get session:", error); } + + const downloadButton = ( + <a + href={DOWNLOAD_URL_MAC_ARM64} + className="px-4 py-2 text-sm font-normal bg-foreground text-background hover:bg-foreground/90 transition-colors flex items-center justify-center gap-2" + > + Download for macOS + <Download className="size-4" aria-hidden="true" /> + </a> + ); if (session) { return ( <> <a href={env.NEXT_PUBLIC_WEB_URL} className="px-4 py-2 text-sm font-normal text-muted-foreground hover:text-foreground transition-colors text-center" > Dashboard </a> - <a - href={DOWNLOAD_URL_MAC_ARM64} - className="px-4 py-2 text-sm font-normal bg-foreground text-background hover:bg-foreground/90 transition-colors flex items-center justify-center gap-2" - > - Download for macOS - <Download className="size-4" aria-hidden="true" /> - </a> + {downloadButton} </> ); } return ( <> <a href={`${env.NEXT_PUBLIC_WEB_URL}/sign-in`} className="px-4 py-2 text-sm font-normal text-muted-foreground hover:text-foreground transition-colors text-center" > Sign In </a> - <a - href={DOWNLOAD_URL_MAC_ARM64} - className="px-4 py-2 text-sm font-normal bg-foreground text-background hover:bg-foreground/90 transition-colors flex items-center justify-center gap-2" - > - Download for macOS - <Download className="size-4" aria-hidden="true" /> - </a> + {downloadButton} </> ); }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid usinganytype - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness
Files:
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
One component per file - do not create multi-component files
Files:
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
apps/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Drizzle ORM for all database operations - never use raw SQL
Files:
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome for formatting and linting - run at root level with
bun run lint:fixorbiome check --write
Files:
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
🧠 Learnings (1)
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/*/src/components/{ui,ai-elements,react-flow}/*.tsx : Use kebab-case single files for shadcn/ui components (e.g., button.tsx, base-node.tsx) in src/components/ui/, src/components/ai-elements, and src/components/react-flow/
Applied to files:
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
🧬 Code graph analysis (1)
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (1)
packages/auth/src/server.ts (1)
auth(11-101)
🔇 Additional comments (1)
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (1)
9-15: LGTM! Error handling properly addresses the PR objective.The try/catch block correctly handles authentication errors from invalid or stale cookies, allowing the component to gracefully degrade to the unauthenticated state. The console logging follows the required prefixed pattern
[marketing/CTAButtons]and provides useful context.
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.