Skip to content

fix(download): 修复社区资源搜索页返回后收藏按钮 hover 失效 [Composer]#3232

Merged
lhx077 merged 1 commit into
PCL-Community:devfrom
cbglzt-alt:fix/issue-3230
Jun 21, 2026
Merged

fix(download): 修复社区资源搜索页返回后收藏按钮 hover 失效 [Composer]#3232
lhx077 merged 1 commit into
PCL-Community:devfrom
cbglzt-alt:fix/issue-3230

Conversation

@cbglzt-alt

@cbglzt-alt cbglzt-alt commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • MyCompItem.RefreshFavoriteStatus 仅更新心形图标(实心/空心),不再修改 ShowFavoriteBtn

问题描述

社区资源搜索列表页(Mod、整合包、资源包、光影、数据包、地图等,均基于 PageComp + MyCompItem)中,列表项 hover 时应显示右侧收藏按钮。

从任意列表项进入详情页再返回后,当前视窗内已渲染的列表项 hover 不再显示收藏按钮;向下滚动后,新进入视窗(懒加载)的列表项 hover 仍正常。

根因

  1. 返回列表时 PageComp_IsVisibleChanged 触发 RefreshAllFavoriteStatus()
  2. RefreshFavoriteStatus()ShowFavoriteBtn = isFavourite
  3. 未收藏项的 PanButtons 被设为 Collapsed,hover 动画条件 ShowFavoriteBtn == true 不再满足
  4. 视窗外尚未实例化的项由 MyVirtualizingElement 懒加载,未经过此次刷新,故表现不一致

影响范围

所有使用 PageComp 的社区资源下载搜索页:

  • Mod
  • 整合包
  • 资源包
  • 光影
  • 数据包
  • 地图

不影响详情页顶部卡片(该处显式 ShowFavoriteBtn = false)。

Test plan

  • Mod 列表:首次进入 hover 正常;进入详情返回后当前视窗内 hover 正常
  • 整合包列表:同上
  • 滚动后新旧列表项 hover 行为一致
  • Debug x64 构建通过

Close #3230

Made with Cursor

Summary by Sourcery

Bug Fixes:

  • 防止在从详情视图返回后,社区下载搜索页面中已渲染项目的收藏悬停按钮消失。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Prevent favorite hover button from disappearing on already-rendered items in community download search pages after navigating back from a detail view.

RefreshFavoriteStatus 误将 ShowFavoriteBtn 设为是否已收藏,
PageComp 重新可见时未收藏项的按钮被 Collapsed,导致 hover 无法展示。

Close PCL-Community#3230

Co-authored-by: Cursor <cursoragent@cursor.com>
@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XS PR 大小评估:微型 labels Jun 21, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 21, 2026

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

Reviewer's Guide

调整 MyCompItem 中收藏状态刷新逻辑,仅更新爱心图标,而不再切换可见性标志,从而确保在从详情页返回后,依旧能保持基于悬停(hover)的收藏按钮显示行为一致。

File-Level Changes

Change Details Files
更新收藏状态刷新逻辑,停止修改 ShowFavoriteBtn 标志,让悬停行为完全由 UI 触发控制。
  • RefreshFavoriteStatus 的 XML 文档注释中进行说明:该方法只更新图标,不影响悬停逻辑。
  • 移除基于“是否为收藏项目”来设置 ShowFavoriteBtn 的赋值逻辑,只保留根据收藏状态切换爱心图标的代码。
Plain Craft Launcher 2/Pages/PageDownload/Comp/MyCompItem.xaml.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#3230 修复社区资源下载搜索页面(例如 MOD 下载搜索页)中条目的收藏按钮在导航离开(例如跳转到详情页或其他下载页)并返回后,悬停时收藏(收藏)按钮偶尔不显示的间歇性问题。

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • 触发一次新的代码审查: 在拉取请求(PR)中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub Issue: 在某条审查评论下回复,请求 Sourcery 基于该评论创建 Issue。你也可以回复 @sourcery-ai issue 来从该评论生成 Issue。
  • 生成拉取请求标题: 在拉取请求标题任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 PR 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文任意位置写上 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 PR 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可(重新)生成审查者指南。
  • 一次性解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不想再看到它们,这很有用。
  • 一次性关闭所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审查。特别适合在你想从头开始一次新的审查时使用——别忘了再评论 @sourcery-ai review 触发新的审查!

Customizing Your Experience

前往你的 dashboard 可以:

  • 启用或停用审查功能,例如 Sourcery 生成的 PR 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查指令。
  • 调整其他审查相关设置。

Getting Help

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

Reviewer's Guide

Adjusts favorite status refresh logic in MyCompItem to only update the heart icon without toggling the visibility flag, ensuring hover-based favorite button display remains consistent after returning from detail pages.

File-Level Changes

Change Details Files
Update favorite status refresh logic to stop mutating the ShowFavoriteBtn flag so hover behavior remains controlled solely by UI triggers.
  • Clarified XML documentation comment on RefreshFavoriteStatus to note it only updates the icon and does not affect hover logic.
  • Removed assignment that set ShowFavoriteBtn based on whether the project is a favorite, leaving only the heart icon swap according to favorite status.
Plain Craft Launcher 2/Pages/PageDownload/Comp/MyCompItem.xaml.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#3230 Fix the intermittent bug where the favorite (收藏) button on items in the community resource download search pages (e.g., mod download search page) sometimes does not appear on hover after navigating away (e.g., to a details or other download page) and returning.

Possibly linked issues


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.

嗨——我已经审查了你的改动,一切看起来都很棒!


Sourcery 对开源项目是免费的——如果你喜欢我们的审查,请考虑分享给更多人 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈不断改进对你的代码审查。
Original comment in English

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 ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@pcl-ce-automation pcl-ce-automation Bot added 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels Jun 21, 2026
@lhx077 lhx077 merged commit e6a44f9 into PCL-Community:dev Jun 21, 2026
3 checks passed
@pcl-ce-automation pcl-ce-automation Bot added 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线 and removed 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 labels Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS PR 大小评估:微型 👌 完成 相关问题已修复或功能已实现,计划在下次版本更新时正式上线

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]: 下载搜索页模组项的收藏按钮可能不显示

4 participants