Skip to content

fix: clear selection state on backup result page back - #844

Draft
pppanghu77 wants to merge 1 commit into
linuxdeepin:release/v20from
pppanghu77:fix/pms-262109-clear-selection-on-back
Draft

pppanghu77 wants to merge 1 commit into
linuxdeepin:release/v20from
pppanghu77:fix/pms-262109-clear-selection-on-back

Conversation

@pppanghu77

@pppanghu77 pppanghu77 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

When the user exports files and clicks "back" on the result page, ZipFileProcessResultWidget::backPage() only emits changeWidget to switch pages but does not emit clearWidget to reset the selection controls. This leaves previously selected files visible when the user returns to the selection page. The same backPage() pattern in ErrorWidget and two other callers correctly emits clearWidget before changeWidget, confirming the omission as the root cause.

Fix

Added emit TransferHelper::instance()->clearWidget(); before the existing changeWidget signal in backPage(), matching the established pattern used by ErrorWidget::backPage() and other callers in the same project.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Single-line addition of a signal emit; no signature change, no public member modification, no history revert
  • Target function backPage() was introduced in commit f5975eee without clearWidget(); this change does not revert any historical fix

Business Impact Scope

Affects the data migration backup export flow: when users return to the selection page after completing a file backup export, their previous file selections are now cleared. No other navigation paths or business modules are affected.

Verification Suggestion

Test the file export → back navigation path to verify selections are cleared. Verify normal export flow and other page navigation paths show no regression.


根因分析

用户导出文件后点击返回时,ZipFileProcessResultWidget::backPage() 仅发射 changeWidget 信号切换页面,未发射 clearWidget 信号清空选择控件状态,导致返回选择页面时历史选择仍保留。同项目中 ErrorWidget::backPage() 等 3 处正确范式均在切换页面前先发射 clearWidget,确认遗漏为根因。

修复方案

在 backPage() 的 changeWidget 信号前新增 emit TransferHelper::instance()->clearWidget();,与同项目内 3 处正确范式保持一致。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 单行信号发射语句新增,未改函数签名、未改公开成员、未撤销历史修复
  • 目标函数 backPage() 自引入以来从未包含 clearWidget() 调用,本次改动不撤销任何已有修复

业务影响范围

影响数据迁移备份导出流程:用户完成文件备份导出后返回选择页面时,历史选择将被清空。其他导航路径和业务模块不受影响。

验证建议

测试文件导出后返回路径,验证选择已清空。验证正常导出流程及其他页面导航路径无回归。

Summary by Sourcery

Bug Fixes:

  • Clear file selections when navigating back from the backup export result page to prevent stale selections from remaining visible.

1. Root cause: backPage() only emitted changeWidget signal to switch
   page, missing clearWidget signal to reset selection controls
2. Fix: add emit clearWidget before changeWidget, matching the
   pattern used by ErrorWidget::backPage() and two other callers
3. Impact: returning to selection page after export now clears
   previous file selections; no effect on other navigation paths

Log: Clear previous file selections when returning to selection page

Influence:
1. Test file export then back to verify selections are cleared
2. Test normal export flow still works correctly
3. Verify no regression on other page navigation paths

fix: 返回选择页面时清空历史选择状态

1. 根因:backPage() 仅发射 changeWidget 信号切换页面,遗漏
   clearWidget 信号清空选择控件状态
2. 方案:在 changeWidget 前添加 emit clearWidget,与
   ErrorWidget::backPage() 等三处正确范式保持一致
3. 影响:导出后返回选择页面将清空历史选择,不影响其他导航路径

Log: 返回选择页面时清空历史选择状态

Influence:
1. 测试文件导出后返回,验证选择已被清空
2. 测试正常导出流程仍正常工作
3. 验证其他页面导航路径无回归

PMS: BUG-262109
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pppanghu77

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pppanghu77
pppanghu77 marked this pull request as draft October 29, 2026 20:01
@sourcery-ai

sourcery-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The backup export result page now clears previously selected files before returning to the selection page, aligning its back-navigation behavior with the established widget pattern.

Sequence diagram for clearing backup selections on back navigation

sequenceDiagram
    actor User
    participant ResultPage as ZipFileProcessResultWidget
    participant TransferHelper
    participant SelectionPage

    User->>ResultPage: backPage()
    ResultPage->>TransferHelper: clearWidget()
    TransferHelper-->>SelectionPage: Clear selected files
    ResultPage->>TransferHelper: changeWidget(PageName::choosewidget)
    TransferHelper-->>SelectionPage: Show selection page
Loading

File-Level Changes

Change Details Files
Reset selection state before navigating back from the backup export result page.
  • Emit clearWidget before switching to the file-selection page.
  • Preserve the existing changeWidget navigation behavior.
src/plugins/data-transfer/core/gui/getbackup/zipfileprocessresultwidget.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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