Skip to content

feat: add delete dataset option to Settings dropdown#125

Open
balasiddarthan22 wants to merge 3 commits into
tinyfish-io:mainfrom
balasiddarthan22:feat/delete-dataset
Open

feat: add delete dataset option to Settings dropdown#125
balasiddarthan22 wants to merge 3 commits into
tinyfish-io:mainfrom
balasiddarthan22:feat/delete-dataset

Conversation

@balasiddarthan22

Copy link
Copy Markdown

Summary

  • Added a Delete dataset button to the Settings dropdown on the dataset page
  • Wires up the existing \�pi.datasets.remove\ Convex mutation which was never called from the UI
  • Shows a confirmation modal before deleting to prevent accidental data loss
  • Redirects to the dashboard after successful deletion

Problem

There was no way to delete a dataset from the UI. If a dataset ended up in a broken state (e.g. created with 0 columns), the user was stuck on a blank page with no recovery path and no way to clean it up.

Test plan

  • Open a dataset, click Settings, confirm Delete dataset appears at the bottom
  • Click Delete dataset, confirm the modal appears
  • Confirm deletion, verify dataset is removed and user is redirected to dashboard
  • Verify cancel dismisses the modal without deleting
  • Verify Delete option only appears for the dataset owner

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1542002f-ffb2-47e0-9686-1fba5919f911

📥 Commits

Reviewing files that changed from the base of the PR and between acc2fa9 and c9b0f7e.

📒 Files selected for processing (1)
  • frontend/app/dataset/[id]/page.tsx

📝 Walkthrough

Walkthrough

This PR adds owner-only dataset deletion on the dataset page: new confirmDelete/deleting state, a Convex api.datasets.remove mutation wired to a guarded handleDelete that navigates to /dashboard on success, an optional onDelete prop on SettingsDropdown to expose the action, and a ConfirmDeleteModal with Escape/click-outside dismiss and disabled UI while deleting.

sequenceDiagram
  participant User
  participant SettingsDropdown
  participant DatasetPage
  participant ConfirmDeleteModal
  participant ConvexAPI
  participant Router

  User->>SettingsDropdown: open settings
  User->>SettingsDropdown: click "Delete dataset"
  SettingsDropdown->>DatasetPage: invoke onDelete()
  DatasetPage->>ConfirmDeleteModal: open modal
  User->>ConfirmDeleteModal: confirm delete
  ConfirmDeleteModal->>DatasetPage: onConfirm()
  DatasetPage->>ConvexAPI: api.datasets.remove(datasetId)
  ConvexAPI-->>DatasetPage: success / error
  DatasetPage->>Router: router.replace("/dashboard")
Loading

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SettingsDropdown
  participant DatasetPage
  participant ConfirmDeleteModal
  participant ConvexAPI
  participant Router

  User->>SettingsDropdown: open settings
  User->>SettingsDropdown: click "Delete dataset"
  SettingsDropdown->>DatasetPage: onDelete()
  DatasetPage->>ConfirmDeleteModal: set confirmDelete = true
  User->>ConfirmDeleteModal: confirm
  ConfirmDeleteModal->>DatasetPage: onConfirm()
  DatasetPage->>ConvexAPI: removeDataset(dataset._id)
  ConvexAPI-->>DatasetPage: result
  alt success
    DatasetPage->>Router: router.replace("/dashboard")
  else error
    DatasetPage->>DatasetPage: captureException(error)
  end
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature added—a delete dataset option in the Settings dropdown—and aligns with the changeset's primary purpose.
Description check ✅ Passed The description is clearly related to the changeset, providing context, problem statement, and a test plan that aligns with the implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@frontend/app/dataset/`[id]/page.tsx:
- Around line 247-256: The delete flow currently closes the confirmation modal
and allows repeated clicks before the async removeDataset completes; update the
confirm action handler and handleDelete to (1) introduce and use an "isDeleting"
boolean (or the mutation's isLoading) to short-circuit duplicate submits, (2) do
NOT close the modal until removeDataset resolves successfully, and (3) only call
router.push("/dashboard") after a successful await removeDataset, while on error
keep the modal open and call captureException(err, { operation:
"dataset_delete", datasetId: dataset._id }) so users see failure and cannot
trigger duplicate destructive requests. Ensure the confirm button is disabled
when isDeleting/isLoading is true.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec46336c-ff9f-42dc-9222-779de9e08114

📥 Commits

Reviewing files that changed from the base of the PR and between 5a2e7c3 and d8ba69b.

📒 Files selected for processing (1)
  • frontend/app/dataset/[id]/page.tsx

Comment thread frontend/app/dataset/[id]/page.tsx

@simantak-dabhade simantak-dabhade left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth looks sound here: datasets.remove calls loadOwnedDataset, so deletion is enforced server-side and not just hidden in the UI.

The only concern I see is lifecycle-related: delete is available while a dataset is building/updating, but deleting doesn’t abort the active backend run. That can leave the workflow spending work until it notices the dataset is gone. Could we disable delete during active runs, or stop the run before deleting?

Comment thread frontend/app/dataset/[id]/page.tsx
@MMeteorL

MMeteorL commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Auth looks sound here: datasets.remove calls loadOwnedDataset, so deletion is enforced server-side and not just hidden in the UI.

The only concern I see is lifecycle-related: delete is available while a dataset is building/updating, but deleting doesn’t abort the active backend run. That can leave the workflow spending work until it notices the dataset is gone. Could we disable delete during active runs, or stop the run before deleting?

I'd agree with @simantak-dabhade here, you may abort an existing building task and delete a building dataset by doing the following:

  • Call POST /stop first (fires the AbortSignal → stops the LLM call immediately, saving API cost). Swallow a 409 if the dataset isn't running.
  • Then call api.datasets.remove Convex mutation (deletes the dataset + all rows). The workflow will either detect the abort signal OR find !currentDataset in its success/failure path and exit gracefully.
  • Navigate to /dashboard.

… runs

- Add deleting state to prevent repeated clicks while mutation is in flight
- Keep modal open until deletion resolves, then navigate with router.replace
- Disable Cancel and confirm button while deleting is in progress
- Hide delete option when dataset is building or updating to avoid orphaned backend runs
@balasiddarthan22

Copy link
Copy Markdown
Author

Thanks for the feedback! I've disabled the delete option while the dataset is building or updating to avoid orphaned backend runs. I also addressed the CodeRabbit comment by adding a deleting guard to prevent duplicate submits and keeping the modal open until the mutation resolves.

# Conflicts:
#	frontend/app/dataset/[id]/page.tsx
@MMeteorL

MMeteorL commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

LGTM! Please review if the blocker can be removed @simantak-dabhade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants