fix: improve resetViewState to avoid animation glitches#685
Merged
Conversation
1. Modified resetViewState function in AppListView.qml and FreeSortListView.qml 2. Temporarily disable highlightFollowsCurrentItem property during reset 3. Set currentIndex to 0 and contentY to 0 to ensure proper reset 4. Restore original highlightFollowsCurrentItem state after reset 5. This prevents animation glitches when resetting view state Log: Fixed animation issues when resetting application list view Influence: 1. Test resetting application list view after search or category filtering 2. Verify that no animation glitches occur during view reset 3. Check that current selection is properly reset to first item 4. Test with different highlight modes and settings 5. Verify that view position is correctly reset to top fix: 改进 resetViewState 函数以避免动画闪烁问题 1. 修改 AppListView.qml 和 FreeSortListView.qml 中的 resetViewState 函数 2. 在重置过程中临时禁用 highlightFollowsCurrentItem 属性 3. 将 currentIndex 设置为 0,contentY 设置为 0 以确保正确重置 4. 重置后恢复原始的 highlightFollowsCurrentItem 状态 5. 这可以防止重置视图状态时出现动画闪烁问题 Log: 修复重置应用列表视图时的动画问题 Influence: 1. 测试在搜索或分类筛选后重置应用列表视图 2. 验证在视图重置过程中不会出现动画闪烁 3. 检查当前选择是否正确重置到第一个项目 4. 使用不同的高亮模式和设置进行测试 5. 验证视图位置是否正确重置到顶部 PMS: BUG-346111
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefines the resetViewState behavior for the app list views by temporarily disabling highlight tracking and explicitly resetting index and scroll position to avoid highlight/animation glitches when resetting the view. Sequence diagram for improved resetViewState behavior in app list viewssequenceDiagram
actor User
participant AppListView
participant ListView as listView
User->>AppListView: trigger resetViewState
AppListView->>ListView: read highlightFollowsCurrentItem
AppListView->>ListView: set highlightFollowsCurrentItem = false
AppListView->>ListView: set currentIndex = 0
AppListView->>ListView: set contentY = 0
AppListView->>ListView: restore highlightFollowsCurrentItem
AppListView->>AppListView: close alphabetCategoryPopup if needed
AppListView->>AppListView: close categoryMenu if needed
AppListView-->>User: view reset without animation glitches
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来对这段代码进行审查:
改进建议:
改进建议代码: function resetViewStateSafely(listView) {
if (!listView) {
console.warn("ListView is null or undefined")
return
}
try {
const wasFollowing = listView.highlightFollowsCurrentItem
listView.highlightFollowsCurrentItem = false
listView.currentIndex = 0
listView.contentY = 0
listView.highlightFollowsCurrentItem = wasFollowing
} catch (error) {
console.error("Error while resetting view state:", error)
}
}
// 在AppListView.qml中:
function resetViewState() {
resetViewStateSafely(listView)
if (!LauncherController.visible) {
alphabetCategoryPopup.close()
if (categoryMenu) categoryMenu.close()
}
}
// 在FreeSortListView.qml中:
function resetViewState() {
resetViewStateSafely(listView)
}这样改进后的代码:
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The resetViewState logic is now duplicated between AppListView and FreeSortListView; consider extracting this into a shared helper or common function to avoid divergence if the reset behavior needs to change again.
- Instead of manually setting currentIndex and contentY, you might call positionViewAtBeginning() while highlightFollowsCurrentItem is temporarily disabled, so you preserve any additional behavior encapsulated in positionViewAtBeginning.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The resetViewState logic is now duplicated between AppListView and FreeSortListView; consider extracting this into a shared helper or common function to avoid divergence if the reset behavior needs to change again.
- Instead of manually setting currentIndex and contentY, you might call positionViewAtBeginning() while highlightFollowsCurrentItem is temporarily disabled, so you preserve any additional behavior encapsulated in positionViewAtBeginning.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
BLumia
approved these changes
Dec 30, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, robertkill The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Fixed animation issues when resetting application list view
Influence:
fix: 改进 resetViewState 函数以避免动画闪烁问题
Log: 修复重置应用列表视图时的动画问题
Influence:
PMS: BUG-346111
Summary by Sourcery
Bug Fixes: