Skip to content

fix: optimize update list performance and fix detail view issues - #332

Open
xionglinlin wants to merge 1 commit into
linuxdeepin:masterfrom
xionglinlin:master
Open

fix: optimize update list performance and fix detail view issues#332
xionglinlin wants to merge 1 commit into
linuxdeepin:masterfrom
xionglinlin:master

Conversation

@xionglinlin

@xionglinlin xionglinlin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
  1. Cache parsed vulnerability level enum in SecurityUpdateLog at load time, sort and count by integer enum instead of looking up vulLevelMap per comparison, eliminating tens of thousands of debug log calls that caused ~6s UI freeze with 1500+ security updates
  2. Fix non-strict weak ordering (>= 0) in security log sort comparators
  3. Remove redundant debug logging from hot paths: vulLevelMap, addDetailInfo and setExplain
  4. Replace detail list Repeater with Loader lazy creation + ListView virtualization, so collapsed cards instantiate zero delegates and expanded lists only create visible items, eliminating ~9s page freeze
  5. Merge expand/collapse into a single toggle button (View More <-> Collapse) at the card title row instead of a Collapse button at the end of a long list
  6. Show scrollbar only when content overflows and keep it always visible while scrollable; fix 400px blank placeholder after collapsing by zeroing Loader height and letting viewport height shrink with content

Log: Update page no longer freezes for seconds with large update sets; detail list scrolls smoothly and collapses without blank space

Influence:

  1. Open Control Center > System Update with a large number of updates (1500+ security CVEs), verify page opens and list renders instantly
  2. Expand system/security update details, verify scrolling is smooth and scrollbar appears only when content overflows
  3. Click Collapse at the title row, verify details collapse and no blank placeholder remains
  4. Verify small update sets (few items) show no scrollbar and no extra spacing
  5. Regression: check update, download, install flows are unaffected

fix: 优化更新列表性能并修复详情展示问题

  1. SecurityUpdateLog 装载时预解析漏洞等级枚举,排序与统计直接用整数枚举 比较,不再每次比较查询 vulLevelMap 并输出日志,消除 1500+ 条安全更新 场景下约 6 秒的 UI 卡顿
  2. 修复安全日志排序比较器中 >= 0 导致的非严格弱序问题
  3. 移除热路径上的冗余调试日志:vulLevelMap、addDetailInfo、setExplain
  4. 详情列表由 Repeater 一次性实例化改为 Loader 惰性创建 + ListView 虚拟化, 折叠时零 delegate,展开时仅实例化可视区项,消除页面打开约 9 秒卡顿
  5. 展开/收起合并为卡片标题行同一位置的切换按钮(View More <-> Collapse), 收起按钮不再沉在长列表末尾
  6. 滚动条仅内容超出一屏时显示,可滚动时常显不透明;修复折叠后残留 400px 空白占位(Loader 高度归零、视口高度随内容收缩)

Log: 更新页面在大规模更新场景下不再长时间卡顿,详情列表滚动流畅、
收起后无空白占位

PMS: BUG-373703

Change-Id: Ia7df7725faea365dc6bec3dad9f369df9e49b0c6

Summary by Sourcery

Optimize large update-list rendering and correct security detail sorting, expansion, and scrolling behavior.

Bug Fixes:

  • Fix security update sorting to use a strict ordering and preserve correct vulnerability severity ordering.
  • Fix detail panel collapsing so it removes the empty placeholder and keeps the view sized to its content.
  • Fix detail list scrolling and scrollbar behavior for both overflowing and short lists.

Enhancements:

  • Improve update-page performance for large security update sets by caching vulnerability levels and virtualizing detail entries.
  • Replace separate expand and collapse controls with a single title-row toggle for update details.
  • Remove redundant debug logging from update detail and vulnerability-processing hot paths.

@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.

Sorry @xionglinlin, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xionglinlin

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

@sourcery-ai

sourcery-ai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

Optimizes the system update list performance and detail view behavior by caching parsed vulnerability levels for sorting/counting, tightening sort comparators, removing hot-path debug logs, and reworking the QML detail list to use lazy loading and ListView virtualization with an improved toggle UX and scrollbar handling.

Sequence diagram for expanded/collapsed update detail list with Loader and ListView virtualization

sequenceDiagram
    actor User
    participant UpdateList_qml as UpdateList_qml
    participant itemCtl as itemCtl
    participant detailLoader as detailLoader
    participant detailView as ListView

    User->>UpdateList_qml: click ToolButton
    UpdateList_qml->>itemCtl: repeater.model.setExpanded(itemCtl.itemIndex, !itemCtl.showDetails)
    itemCtl-->>detailLoader: showDetails changes

    alt showDetails becomes true (expand)
        detailLoader-->>detailLoader: active = true
        detailLoader->>detailView: create ListView from sourceComponent
        detailView-->>detailView: implicitHeight = min(max(contentHeight, 1), 500)
        detailView-->>detailView: ScrollBar.vertical.policy = ScrollBar.AsNeeded
    else showDetails becomes false (collapse)
        detailLoader-->>detailLoader: active = false
        detailLoader-->>detailLoader: preferredHeight = 0
        detailLoader-->>detailView: destroy delegates
    end
Loading

File-Level Changes

Change Details Files
Rework the QML update detail list to use lazy loading and virtualization, and unify the expand/collapse UX.
  • Change the "View More" button to be always visible when details exist and to toggle expansion/collapse instead of only expanding.
  • Replace the Repeater-based detail list with a Loader that is only active when details are shown, hosting a ListView that virtualizes delegates and scrolls internally.
  • Configure ListView implicitHeight bounds and ScrollBar policy so that only visible items are instantiated, content overflows scroll inside the card, and separator drawing is per delegate.
src/dcc-update-plugin/qml/UpdateList.qml
Cache and reuse parsed vulnerability level enums to avoid repeated lookups and logging in security update handling.
  • Introduce a vulLevelFromString helper that maps level strings to the VulLevel enum.
  • Extend SecurityUpdateLog to store a pre-parsed VulLevel value at load time.
  • Update security log sorting, detail aggregation, and history handling to use the cached enum value and a simple map for counting instead of repeated map lookups.
src/dcc-update-plugin/operation/updateloghelper.h
src/dcc-update-plugin/operation/updateloghelper.cpp
Tighten sort comparators to provide strict weak ordering and correct tie-breaking by CVE/name.
  • Change security update sort comparator to compare CVE IDs with a strict greater-than condition when levels are equal.
  • Update history details sort comparator to use vulLevelFromString and strict greater-than for name comparison when levels match.
src/dcc-update-plugin/operation/updateloghelper.cpp
Remove or reduce debug logging and unnecessary work on hot paths to avoid UI freezes.
  • Remove debug logging in vulLevelMap and addDetailInfo.
  • Avoid redundant work in setExplain by early-returning when the explanation string is unchanged.
  • Update copyright year range in the header file to 2026.
src/dcc-update-plugin/operation/updateloghelper.cpp
src/dcc-update-plugin/operation/updateloghelper.h
src/dcc-update-plugin/operation/updateiteminfo.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

1. Cache parsed vulnerability level enum in SecurityUpdateLog at load time,
   sort and count by integer enum instead of looking up vulLevelMap per
   comparison, eliminating tens of thousands of debug log calls that caused
   ~6s UI freeze with 1500+ security updates
2. Fix non-strict weak ordering (>= 0) in security log sort comparators
3. Remove redundant debug logging from hot paths: vulLevelMap,
   addDetailInfo and setExplain
4. Replace detail list Repeater with Loader lazy creation + ListView
   virtualization, so collapsed cards instantiate zero delegates and
   expanded lists only create visible items, eliminating ~9s page freeze
5. Merge expand/collapse into a single toggle button (View More <-> Collapse)
   at the card title row instead of a Collapse button at the end of a long list
6. Show scrollbar only when content overflows and keep it always visible
   while scrollable; fix 400px blank placeholder after collapsing by zeroing
   Loader height and letting viewport height shrink with content

Log: Update page no longer freezes for seconds with large update sets;
detail list scrolls smoothly and collapses without blank space

Influence:
1. Open Control Center > System Update with a large number of updates
   (1500+ security CVEs), verify page opens and list renders instantly
2. Expand system/security update details, verify scrolling is smooth and
   scrollbar appears only when content overflows
3. Click Collapse at the title row, verify details collapse and no blank
   placeholder remains
4. Verify small update sets (few items) show no scrollbar and no extra
   spacing
5. Regression: check update, download, install flows are unaffected

fix: 优化更新列表性能并修复详情展示问题

1. SecurityUpdateLog 装载时预解析漏洞等级枚举,排序与统计直接用整数枚举
   比较,不再每次比较查询 vulLevelMap 并输出日志,消除 1500+ 条安全更新
   场景下约 6 秒的 UI 卡顿
2. 修复安全日志排序比较器中 >= 0 导致的非严格弱序问题
3. 移除热路径上的冗余调试日志:vulLevelMap、addDetailInfo、setExplain
4. 详情列表由 Repeater 一次性实例化改为 Loader 惰性创建 + ListView 虚拟化,
   折叠时零 delegate,展开时仅实例化可视区项,消除页面打开约 9 秒卡顿
5. 展开/收起合并为卡片标题行同一位置的切换按钮(View More <-> Collapse),
   收起按钮不再沉在长列表末尾
6. 滚动条仅内容超出一屏时显示,可滚动时常显不透明;修复折叠后残留
   400px 空白占位(Loader 高度归零、视口高度随内容收缩)

Log: 更新页面在大规模更新场景下不再长时间卡顿,详情列表滚动流畅、
收起后无空白占位

PMS: BUG-373703

Change-Id: Ia7df7725faea365dc6bec3dad9f369df9e49b0c6
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