Add delete collection with confirmation - #29
Conversation
Deleting a collection now removes it and all links inside it, gated by a confirmation dialog on the collections list page. The DB cascade already handled collection_items; the new DELETE route also cleans up now-orphaned urls rows, mirroring the existing single-link delete route. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesCollection deletion
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CollectionsList
participant UseDeleteCollection
participant CollectionsApi
participant DeleteEndpoint
CollectionsList->>UseDeleteCollection: Confirm collection deletion
UseDeleteCollection->>CollectionsApi: deleteCollection(id)
CollectionsApi->>DeleteEndpoint: DELETE /api/collections/:id
DeleteEndpoint-->>CollectionsApi: Return 204
CollectionsApi-->>UseDeleteCollection: Resolve deletion
UseDeleteCollection->>CollectionsList: Refresh collections
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/features/collections/ui/collections-list.vue (1)
19-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove the refresh result-handling logic into a model composable.
refreshCollectionsinspectserror.valueand conditionally re-throws, which is result-handling logic embedded directly in this presentational component's script. Move this behavior intouseCollections(for example, expose arefreshthat already throws on failure) so this.vuefile stays a thin consumer of composable state.As per coding guidelines, "Keep feature UI components presentational; place state, business logic, result handling, and API calls in the corresponding
model/composables."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/features/collections/ui/collections-list.vue` around lines 19 - 26, Move the error-aware refresh behavior from the component-level refreshCollections function into the useCollections composable, exposing a refresh operation that awaits the underlying refresh and rethrows error.value on failure. Update the component to consume that composable method while preserving useDeleteCollection’s failure propagation through refreshError.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/features/collections/model/use-delete-collection.ts`:
- Around line 27-42: Prevent dismissal during an in-flight deletion by making
cancelDelete no-op when deletePending.value is true; this also guards the
isDialogOpen setter. In app/features/collections/model/use-delete-collection.ts
lines 27-42, update cancelDelete accordingly. In
app/features/collections/ui/collections-list.vue lines 106-123, disable the
Cancel button with deletePending to match the Confirm button’s loading state.
---
Nitpick comments:
In `@app/features/collections/ui/collections-list.vue`:
- Around line 19-26: Move the error-aware refresh behavior from the
component-level refreshCollections function into the useCollections composable,
exposing a refresh operation that awaits the underlying refresh and rethrows
error.value on failure. Update the component to consume that composable method
while preserving useDeleteCollection’s failure propagation through refreshError.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 77fecac8-0b85-41fd-b606-1065763860d8
📒 Files selected for processing (9)
app/features/collections/index.tsapp/features/collections/model/__tests__/use-delete-collection.test.tsapp/features/collections/model/use-delete-collection.tsapp/features/collections/ui/collections-list.vueapp/shared/api/collections.tsapp/shared/testing/mocks/collections-api.tsi18n/locales/en.jsoni18n/locales/ru.jsonserver/api/collections/[id].delete.ts
cancelDelete (and thus the isDialogOpen v-model setter) no-oped while a delete is in flight; the Cancel button is disabled to match. Without this, dismissing the dialog for one collection while its delete was still pending let the stale confirmDelete continuation null out whatever collection a newly re-opened dialog was targeting once it resolved. Addresses a CodeRabbit review comment on PR #29. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Addressed the review:
|
Summary
DELETE /api/collections/[id]route: verifies ownership, deletes the collection (cascadescollection_itemsvia the existing DB FK), and cleans up now-orphanedurlscache rowsuseDeleteCollectioncomposable manages the shared confirmation dialog for the list, mirroring the existinguseCollectionLinkspatternen.jsonandru.jsonTest plan
pnpm type-check,pnpm lint,pnpm format— cleanpnpm test— 188/188 passing (added 13 new tests foruseDeleteCollection)collections,collection_items, and the now-orphanedurlsrow are all cleaned up after delete🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes