Skip to content

fix: 修复返回 VersionSaves 页面时同步子页面状态#3347

Open
LuLu-ling wants to merge 1 commit into
devfrom
fix/3341
Open

fix: 修复返回 VersionSaves 页面时同步子页面状态#3347
LuLu-ling wants to merge 1 commit into
devfrom
fix/3341

Conversation

@LuLu-ling

@LuLu-ling LuLu-ling commented Jul 5, 2026

Copy link
Copy Markdown
Member

close #3341

Summary by Sourcery

错误修复:

  • 修正返回到 VersionSaves/InstanceSavesLeft 视图时的子页面选择,使子页面与当前存档匹配。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Correct child page selection when returning to the VersionSaves/InstanceSavesLeft view so the subpage matches the current save.

@LuLu-ling LuLu-ling requested a review from a team July 5, 2026 06:51
@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XS PR 大小评估:微型 labels Jul 5, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
评审者指南(在小型 PR 上折叠)

评审者指南

该 PR 确保在导航返回到 VersionSaves 页面时,通过在触发页面切换动画之前,从已有的 PageInstanceSavesLeft 实例派生子页面 ID,使选中的子页面与实际子页面状态保持同步。

返回 VersionSaves 时同步子页面的时序图

sequenceDiagram
    participant FormMain
    participant PageInstanceSavesLeft

    FormMain->>PageInstanceSavesLeft: new PageInstanceSavesLeft() [if frmInstanceSavesLeft is null]
    FormMain->>PageInstanceSavesLeft: set currentSave = stack.additional.Value.SavePath
    FormMain->>PageInstanceSavesLeft: read pageID
    FormMain->>FormMain: subType = frmInstanceSavesLeft.pageID
    FormMain->>PageInstanceSavesLeft: PageGet(subType)
    FormMain->>FormMain: PageChangeAnim(frmInstanceSavesLeft, PageGet(subType))
Loading

文件级变更

变更 详情 文件
在返回到 VersionSaves 页面时,在执行页面切换动画之前,将子页面类型与 PageInstanceSavesLeft 当前页面 ID 同步。
  • 在设置 PageInstanceSavesLeft.currentSave 之后,立刻从 ModMain.frmInstanceSavesLeft.pageID 赋值 subType 变量。
  • 在调用 PageChangeAnim 时使用更新后的 subType 值,即 ModMain.frmInstanceSavesLeft.PageGet(subType),从而让动画作用于正确的子页面。
Plain Craft Launcher 2/FormMain.xaml.cs

与关联问题的对照评估

问题 目标 是否解决 说明
#3341 修复在从某实例的存档管理打开数据包下载页面并返回后,VersionSaves/数据包管理视图显示错误的(存档)信息,而不是正确的数据包子页面内容的 bug。

提示与指令

与 Sourcery 交互

  • 触发新的代码评审: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的评审评论。
  • 从评审评论生成 GitHub issue: 通过回复某条评审评论让 Sourcery 从该评论创建一个 issue。你也可以在评审评论下回复 @sourcery-ai issue 来从这条评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在你需要的位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来随时(重新)生成摘要。
  • 生成评审者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成评审者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可标记解决所有 Sourcery 评论。适用于你已经处理完所有评论且不希望再看到它们的情况。
  • 撤销所有 Sourcery 评审: 在 pull request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 评审。对于希望从一次全新的评审开始特别有用——别忘了再评论 @sourcery-ai review 来触发新的评审!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用评审功能,例如 Sourcery 生成的 pull request 摘要、评审者指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审说明。
  • 调整其他评审设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR ensures that when navigating back to the VersionSaves page, the selected subpage stays in sync with the actual subpage state by deriving the subpage ID from the existing PageInstanceSavesLeft instance before triggering the page change animation.

Sequence diagram for syncing subpage when returning to VersionSaves

sequenceDiagram
    participant FormMain
    participant PageInstanceSavesLeft

    FormMain->>PageInstanceSavesLeft: new PageInstanceSavesLeft() [if frmInstanceSavesLeft is null]
    FormMain->>PageInstanceSavesLeft: set currentSave = stack.additional.Value.SavePath
    FormMain->>PageInstanceSavesLeft: read pageID
    FormMain->>FormMain: subType = frmInstanceSavesLeft.pageID
    FormMain->>PageInstanceSavesLeft: PageGet(subType)
    FormMain->>FormMain: PageChangeAnim(frmInstanceSavesLeft, PageGet(subType))
Loading

File-Level Changes

Change Details Files
Sync the subpage type with PageInstanceSavesLeft’s current page ID before performing the page change animation when returning to the VersionSaves page.
  • Assign the subType variable from ModMain.frmInstanceSavesLeft.pageID right after setting PageInstanceSavesLeft.currentSave.
  • Use the updated subType value when calling PageChangeAnim with ModMain.frmInstanceSavesLeft.PageGet(subType) so the animation targets the correct subpage.
Plain Craft Launcher 2/FormMain.xaml.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#3341 Fix the bug where, after opening the datapack download page from an instance's save management and returning, the VersionSaves/datapack management view shows incorrect (save) information instead of the correct datapack subpage content.

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
Contributor

Choose a reason for hiding this comment

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

Hey - 我给出了几点总体反馈:

  • 建议将 ModMain.frmInstanceSavesLeft.pageID 赋值给一个局部变量,而不是去修改 subType,以避免在 PageChangeActual 中后续复用 subType 时出现副作用。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- Consider assigning `ModMain.frmInstanceSavesLeft.pageID` to a local variable instead of mutating `subType`, to avoid side effects if `subType` is reused later in `PageChangeActual`.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码评审。
Original comment in English

Hey - I've left some high level feedback:

  • Consider assigning ModMain.frmInstanceSavesLeft.pageID to a local variable instead of mutating subType, to avoid side effects if subType is reused later in PageChangeActual.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider assigning `ModMain.frmInstanceSavesLeft.pageID` to a local variable instead of mutating `subType`, to avoid side effects if `subType` is reused later in `PageChangeActual`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Labels

size: XS PR 大小评估:微型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]:在打开数据包下载再返回后,数据包界面显示存档信息

1 participant