-
Notifications
You must be signed in to change notification settings - Fork 1k
improvement: only show uploading card when uploading a video #996
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
Conversation
WalkthroughComponents now read Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as Caps / FolderVideosSection
participant UC as UploadingContext
participant Data as Caps Data
User->>UI: Open view
UI->>UC: useUploadingContext()
UC-->>UI: { isUploading, uploadingCapId }
UI->>Data: fetch caps/videos list
Data-->>UI: [items...]
alt isUploading == true
UI->>UI: filter out item with id == uploadingCapId
note right of UI #DDEBF7: Uploading item hidden from grid\nUploadPlaceholderCard shown separately
end
UI-->>User: Render grid (without uploading item)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks (1 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (1 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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/app/(org)/dashboard/caps/Caps.tsx (1)
76-83: Enforce Video.VideoId type on uploadingCapId in UploadingContextIn apps/web/app/(org)/dashboard/caps/UploadingContext.tsx, change
uploadingCapId: string | null→uploadingCapId: Video.VideoId | nullsetUploadingCapId: (id: string | null) => void→setUploadingCapId: (id: Video.VideoId | null) => voidThen verify all callers (e.g., comparisons to
cap.id, calls tosetUploadingCapId(null)) conform to the new type.
🧹 Nitpick comments (1)
apps/web/app/(org)/dashboard/caps/Caps.tsx (1)
334-347: Avoid “phantom” selections when the uploading cap is hidden.If a user had selected the cap before upload begins, it stays in
selectedCapsbut is now hidden, which can confuse the SelectedCapsBar and bulk-delete. Consider auto-deselecting the uploading cap while it’s uploading.Add this effect near the other effects:
useEffect(() => { if (isUploading && uploadingCapId) { setSelectedCaps((prev) => prev.filter((id) => id !== uploadingCapId)); } }, [isUploading, uploadingCapId]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/app/(org)/dashboard/caps/Caps.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for client-side server state and data fetching in the web app
Mutations should call Server Actions and perform precise cache updates with setQueryData/setQueriesData, avoiding broad invalidations
Prefer Server Components for initial data and pass initialData to client components for React Query hydration
Files:
apps/web/app/(org)/dashboard/caps/Caps.tsx
{apps/web,packages/ui}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
{apps/web,packages/ui}/**/*.{ts,tsx}: Use Tailwind CSS exclusively for styling in the web app and shared React UI components
Component naming: React components in PascalCase; hooks in camelCase starting with 'use'
Files:
apps/web/app/(org)/dashboard/caps/Caps.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use strict TypeScript and avoid any; prefer shared types from packages
**/*.{ts,tsx}: Use Biome to format/lint TypeScript with a 2-space indent
TypeScript file names should be kebab-case (e.g., user-menu.tsx)
Files:
apps/web/app/(org)/dashboard/caps/Caps.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
React/Solid components should be named using PascalCase
Files:
apps/web/app/(org)/dashboard/caps/Caps.tsx
🧬 Code graph analysis (1)
apps/web/app/(org)/dashboard/caps/Caps.tsx (1)
apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (1)
CapCard(80-475)
⏰ 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). (3)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/web/app/(org)/dashboard/caps/Caps.tsx (1)
325-327: LGTM: correct, minimal filter to hide the uploading cap.The predicate
!isUploading || cap.id !== uploadingCapIdis precise and safe whenuploadingCapIdis null.
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: 0
🧹 Nitpick comments (2)
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx (2)
167-169: Make the filter intent explicit and avoid recomputationReadability: the predicate is easier to parse as “hide when uploading AND ids match.” Also, memoize the filtered list to avoid filtering on every render.
Apply this diff in the render block:
- {initialVideos - .filter((cap) => !isUploading || cap.id !== uploadingCapId) - .map((video) => ( + {visibleVideos.map((video) => (Then add this near the top of the component (e.g., after Line 149, before return):
const visibleVideos = useMemo( () => isUploading && uploadingCapId ? initialVideos.filter((video) => video.id !== uploadingCapId) : initialVideos, [initialVideos, isUploading, uploadingCapId], );Note: If multi-upload is planned later, switch uploadingCapId to a Set and filter with a has() check.
1-1: File naming: prefer kebab-case for .tsx filesTo match the repo guideline, consider renaming to
folder-videos-section.tsx.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for client-side server state and data fetching in the web app
Mutations should call Server Actions and perform precise cache updates with setQueryData/setQueriesData, avoiding broad invalidations
Prefer Server Components for initial data and pass initialData to client components for React Query hydration
Files:
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
{apps/web,packages/ui}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
{apps/web,packages/ui}/**/*.{ts,tsx}: Use Tailwind CSS exclusively for styling in the web app and shared React UI components
Component naming: React components in PascalCase; hooks in camelCase starting with 'use'
Files:
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use strict TypeScript and avoid any; prefer shared types from packages
**/*.{ts,tsx}: Use Biome to format/lint TypeScript with a 2-space indent
TypeScript file names should be kebab-case (e.g., user-menu.tsx)
Files:
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
React/Solid components should be named using PascalCase
Files:
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
🧬 Code graph analysis (1)
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx (2)
apps/web/app/(org)/dashboard/caps/UploadingContext.tsx (1)
useUploadingContext(21-29)apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx (1)
CapCard(80-475)
⏰ 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). (3)
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Analyze (rust)
🔇 Additional comments (2)
apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx (2)
30-30: LGTM: Correctly pulling uploadingCapId from contextThis aligns with the PR goal and keeps the component’s state minimal.
170-181: Confirm delete semantics for single-card DeleteClicking Delete on one card currently deletes all selected caps (
selectedCaps). If this is intentional (card Delete acts as “bulk delete”), ignore. If not, consider scoping to the card:- onDelete={() => deleteCaps.mutateAsync(selectedCaps)} + onDelete={() => deleteCaps.mutateAsync([video.id])}
Summary by CodeRabbit