-
Notifications
You must be signed in to change notification settings - Fork 918
fix: copy link #1072
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
fix: copy link #1072
Conversation
WalkthroughUpdates CapCard’s copy-link logic to generate environment-aware URLs using buildEnv and NODE_ENV, switching from copying the raw cap.id to copying either a cap.link URL in production CAP environment or a site-relative /s/{id} URL otherwise. Import adjustments and internal behavior change only; no exported API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant CC as CapCard Component
participant Env as buildEnv/NODE_ENV
participant CL as Clipboard
participant UI as UI Feedback
U->>CC: Click "Copy Link"
CC->>Env: Read NEXT_PUBLIC_IS_CAP, NODE_ENV
alt CAP production
CC->>CC: url = "https://cap.link/" + cap.id
else Other env
CC->>CC: url = location.origin + "/s/" + cap.id
end
CC->>CL: navigator.clipboard.writeText(url)
CL-->>CC: Promise resolved/rejected
alt Success
CC->>UI: Show "Copied" feedback
else Error
CC->>UI: Show error feedback (if any)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and data fetching in the web app
Web mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData rather than broad invalidations
Client code should use useEffectQuery/useEffectMutation and useRpcClient from apps/web/lib/EffectRuntime.ts; do not create ManagedRuntime inside components
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
apps/web/app/**/*.{tsx,ts}
📄 CodeRabbit inference engine (CLAUDE.md)
Prefer Server Components for initial data in the Next.js App Router and pass initialData to client components
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx,js,jsx,rs}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not add inline, block, or docstring comments in any language; code must be self-explanatory
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use strict TypeScript and avoid any; leverage shared types from packages
**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by runningpnpm format.
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g.,user-menu.tsx).
Use PascalCase for React/Solid components.
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
apps/web/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
On the client, always use
useEffectQueryoruseEffectMutationfrom@/lib/EffectRuntime; never callEffectRuntime.run*directly in components.
Files:
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Vercel Agent Review
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Analyze (rust)
| buildEnv.NEXT_PUBLIC_IS_CAP && NODE_ENV === "production" | ||
| ? `https://cap.link/${cap.id}` | ||
| : `${location.origin}/s/${cap.id}`, |
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.
Fix missing /s/ path segment in copied production URL.
In production we currently copy https://cap.link/${cap.id}, but the share route in this component still points to /s/${cap.id} (see Line 503). The copied link will 404 without that segment. Please include /s/ in the production branch.
- ? `https://cap.link/${cap.id}`
+ ? `https://cap.link/s/${cap.id}`🤖 Prompt for AI Agents
In apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx around lines
325 to 327, the production branch of the copied share URL omits the required
"/s/" segment causing 404s; update the ternary so the production URL includes
"/s/" (i.e., use "https://cap.link/s/${cap.id}" when buildEnv.NEXT_PUBLIC_IS_CAP
&& NODE_ENV === 'production') so it matches the share route used elsewhere.
Summary by CodeRabbit