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 update list rendering and vulnerability processing so large update sets open responsively and detail views remain smooth when expanded or collapsed.

Bug Fixes:

  • Fix security update sorting to use strict ordering and correct severity-based ordering and counting.
  • Fix expanded update details collapsing without leaving blank space and improve scrollbar behavior for overflowing content.

Enhancements:

  • Improve update-page responsiveness for large update sets by caching vulnerability levels, removing hot-path debug logging, and virtualizing detail list rendering.
  • Unify detail expansion and collapse into a single title-row toggle control.

@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

@sourcery-ai

sourcery-ai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

The update page now avoids repeated severity lookups and hot-path logging, uses strict cached-enum sorting, and lazily virtualizes expanded detail lists with content-aware sizing and a unified expand/collapse control to eliminate large-list freezes and collapsed blank space.

Sequence diagram for lazy update detail rendering

sequenceDiagram
    participant User
    participant UpdateList
    participant Loader
    participant ListView
    participant DetailModel

    User->>UpdateList: setExpanded(itemIndex, true)
    UpdateList->>Loader: active = true
    Loader->>ListView: create detail view
    ListView->>DetailModel: read detailModel
    ListView-->>UpdateList: instantiate visible delegates
    User->>UpdateList: setExpanded(itemIndex, false)
    UpdateList->>Loader: active = false
    Loader-->>UpdateList: height = 0
Loading

Flow diagram for update detail expansion and scrolling

flowchart TD
    A[Update card] --> B{showDetails}
    B -->|false| C[Loader inactive\nzero height]
    B -->|true| D[Loader creates ListView]
    D --> E[contentHeight measured]
    E --> F{content overflows 500px?}
    F -->|no| G[Show all content\nno scrollbar]
    F -->|yes| H[Viewport capped at 500px\nvirtualized visible delegates\nscrollbar visible]
    A --> I[Title-row toggle]
    I --> B
Loading

File-Level Changes

Change Details Files
Cache vulnerability severity at parse time and use strict, enum-based ordering and aggregation.
  • Added a parsed VulLevel field to SecurityUpdateLog during JSON deserialization.
  • Changed security sorting and counts to use integer enum values instead of repeated map lookups.
  • Corrected comparator tie-breaking from non-strict >= to strict > and removed hot-path map logging.
  • Retained display-label lookup where needed and parsed historical detail levels for sorting and summaries.
src/dcc-update-plugin/operation/updateloghelper.h
src/dcc-update-plugin/operation/updateloghelper.cpp
Reduce unnecessary update-detail processing and logging.
  • Made setExplain a no-op when the value is unchanged.
  • Removed debug logging from detail insertion and vulnerability-map access.
src/dcc-update-plugin/operation/updateiteminfo.cpp
src/dcc-update-plugin/operation/updateloghelper.cpp
Virtualize update detail rendering and correct expansion layout behavior.
  • Replaced the eagerly instantiated detail Repeater with an active-on-expand Loader containing a virtualized ListView.
  • Bound the detail viewport height to content up to 500px so collapsed cards occupy no detail space and long lists scroll internally.
  • Moved expand/collapse to a single title-row toggle and removed the list-end collapse control.
  • Configured the scrollbar to appear only for overflowing content while remaining active during scrolling.
src/dcc-update-plugin/qml/UpdateList.qml

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

1 similar comment
@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 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 found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/dcc-update-plugin/operation/updateloghelper.cpp" line_range="211-214" />
<code_context>
-                const auto &pair = vulLevelMap().value(detail.vulLevel);
-                auto count = vulCount.value(pair.first, 0);
-                vulCount[pair.first] = ++count;
+                const auto level = vulLevelFromString(detail.vulLevel);
+                vulCount[level]++;
                 item.summary = sumCveLevelUp(vulCount);
-                detail.displayVulLevel = pair.second;
+                detail.displayVulLevel = vulLevelMap().value(detail.vulLevel).second;
             }
             std::sort(item.details.begin(), item.details.end(), [](const HistoryItemDetail& v1, const HistoryItemDetail& v2) -> bool {
</code_context>
<issue_to_address>
**issue (broader_impact):** History entries with an uppercase vulnerability level are counted under the parsed severity (for example, `HIGH` becomes `VulLevel_High`) but their display level is looked up using the original case and becomes an empty string, so the summary and visible detail disagree.

**Triggers:** When historical update logs contain vulnerability levels with casing other than lowercase.

**Suggested fix:** Normalize `detail.vulLevel` before both parsing and the `vulLevelMap()` lookup, or use one shared normalized lookup result for counting and display.
</issue_to_address>

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.

Comment on lines +211 to +214
const auto level = vulLevelFromString(detail.vulLevel);
vulCount[level]++;
item.summary = sumCveLevelUp(vulCount);
detail.displayVulLevel = pair.second;
detail.displayVulLevel = vulLevelMap().value(detail.vulLevel).second;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (broader_impact): History entries with an uppercase vulnerability level are counted under the parsed severity (for example, HIGH becomes VulLevel_High) but their display level is looked up using the original case and becomes an empty string, so the summary and visible detail disagree.

Triggers: When historical update logs contain vulnerability levels with casing other than lowercase.

Suggested fix: Normalize detail.vulLevel before both parsing and the vulLevelMap() lookup, or use one shared normalized lookup result for counting and display.

@deepin-bot

deepin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 1.0.62
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #340

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