Skip to content

fix(settings): simplify danger zone entry#1681

Merged
zerob13 merged 2 commits into
devfrom
fix/data-settings-danger-zone-entry
May 27, 2026
Merged

fix(settings): simplify danger zone entry#1681
zerob13 merged 2 commits into
devfrom
fix/data-settings-danger-zone-entry

Conversation

@yyhhyyyyyy
Copy link
Copy Markdown
Collaborator

@yyhhyyyyyy yyhhyyyyyy commented May 27, 2026

iShot_2026-05-27_10.23.59.mp4

Summary by CodeRabbit

  • Documentation

    • Added feature spec, implementation plan and task checklist for the data settings reset UI.
  • New Features

    • Replaced multiple prominent destructive buttons with a single, less prominent reset entry.
    • Reset dialog now opens with "chat" selected by default.
  • Tests

    • Updated tests to cover the single reset entry, dialog options and reset-type behavior.
  • Chores

    • Updated pinned tooling version.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7697422f-3539-44ed-8366-394fef91f973

📥 Commits

Reviewing files that changed from the base of the PR and between 1602054 and 2e5a460.

📒 Files selected for processing (1)
  • mise.toml
✅ Files skipped from review due to trivial changes (1)
  • mise.toml

📝 Walkthrough

Walkthrough

This PR consolidates the Data Settings "Danger Zone" reset UI by replacing three always-visible destructive buttons with a single low-noise outline reset entry. The confirmation dialog remains the authoritative mechanism for selecting reset type, and opening the dialog now defaults the selected type to chat. Test IDs enable stable testing coverage.

Changes

Data Settings Danger Zone Reset Entry

Layer / File(s) Summary
Documentation and Specification
docs/features/data-settings-danger-zone-entry/plan.md, docs/features/data-settings-danger-zone-entry/spec.md, docs/features/data-settings-danger-zone-entry/tasks.md
Plan, spec, and task documents define the intended behavior: replace three destructive buttons with a single outline reset entry, keep confirmation dialog and radio choices as source of truth for reset type, default dialog to chat, maintain existing presenter call semantics, and update focused test coverage.
UI Component Changes
src/renderer/settings/components/DataSettings.vue
Reset entry button replaced with outline/destructive styling and data-testid="danger-zone-reset-entry", opens dialog via openResetDialog() with no arguments. Dialog option rows (chat, knowledge, config, all) apply conditional destructive styling when selected and include data-testid attributes. openResetDialog() refactored to set resetType = 'chat' before opening dialog.
Test Helpers, Render Assertions, and Behavior Verification
test/renderer/components/DataSettings.test.ts
Test helper added to locate reset entry button. Render assertions updated to verify entry button and dialog option elements via data-testid for all four reset types. Behavior tests updated: sync-disabled state verifies entry and confirm buttons are enabled; import-disabled state verifies both buttons become disabled and confirm does not call the presenter. New tests verify dialog defaults to chat on opening and selecting knowledge calls resetDataByType('knowledge').
Tooling Pin
mise.toml
Pinned pnpm updated from 10.13.1 to 10.33.4.

Sequence Diagram

sequenceDiagram
  participant User
  participant DataSettings
  participant ResetDialog
  User->>DataSettings: Click danger-zone reset entry
  DataSettings->>DataSettings: openResetDialog()
  DataSettings->>DataSettings: Set resetType = 'chat'
  DataSettings->>ResetDialog: Open dialog (chat selected)
  User->>ResetDialog: Select option (e.g., knowledge)
  ResetDialog->>ResetDialog: Update resetType
  User->>ResetDialog: Click confirm
  DataSettings->>DataSettings: Call devicePresenter.resetDataByType(resetType.value)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#689: Backend support for the 'knowledge' reset type and its database-reset logic that this PR's updated dialog calls.
  • ThinkInAIXYZ/deepchat#668: Added the resetDataByType presenter method that this PR's component invokes with the selected reset type.

Suggested reviewers

  • zerob13

Poem

🐰 A reset once shouted, now whispers in gray,
One small outline beckons, not shouting away.
Chat chosen by default, choices tidy and neat,
The tests hop along to make the flow complete. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(settings): simplify danger zone entry' accurately reflects the main change: replacing three destructive buttons with a single simplified reset entry, making the danger zone UI less prominent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
  • Commit unit tests in branch fix/data-settings-danger-zone-entry

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.

@zerob13 zerob13 merged commit c6b2264 into dev May 27, 2026
3 checks passed
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.

2 participants