fix: guard hasAuth binding against undefined config (SystemProxyConfigItem.qml:17) - #606
fix: guard hasAuth binding against undefined config (SystemProxyConfigItem.qml:17)#60652cyb wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 52cyb 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR eliminates a runtime TypeError in the SystemProxyConfigItem QML component by making the hasAuth property binding resilient to an undefined config object and updating the SPDX copyright year range header. Sequence diagram for guarded hasAuth evaluation in SystemProxyConfigItemsequenceDiagram
participant SystemProxyConfigItem
participant QtQueuedConnection
participant ConfigSource as manualProxy
SystemProxyConfigItem->>SystemProxyConfigItem: evaluate hasAuth = !!(config && config.auth)
note over SystemProxyConfigItem: initial config is null
QtQueuedConnection->>SystemProxyConfigItem: deliver config from manualProxy
SystemProxyConfigItem->>SystemProxyConfigItem: re-evaluate hasAuth = !!(config && config.auth)
note over SystemProxyConfigItem: no TypeError when config is undefined/null
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
7fc4619 to
027107c
Compare
1. Add null guard to hasAuth binding in SystemProxyConfigItem.qml 2. config is undefined during async manualProxy data load 3. Use !!(config && config.auth) to avoid TypeError warning Log: Eliminated TypeError warning when opening system proxy settings Influence: 1. Open control center network system proxy page 2. Verify no TypeError at SystemProxyConfigItem.qml:17 3. Check manual/auto proxy switch, auth toggle and save fix: 修复系统代理配置项 hasAuth 绑定空安全 1. 为 SystemProxyConfigItem.qml 的 hasAuth 绑定增加空安全守卫 2. manualProxy 数据跨线程异步加载,组件实例化时 config 为 undefined 3. 改用 !!(config && config.auth) 避免 TypeError 运行警告 Log: 消除打开系统代理设置时的 TypeError 运行警告 Influence: 1. 进入控制中心-网络-系统代理页面 2. 确认 SystemProxyConfigItem.qml:17 不再报 TypeError 3. 验证手动/自动代理切换、认证开关及保存功能正常 PMS: TASK-392413 https://pms.uniontech.com/task-view-392413.html
027107c to
a3ffb16
Compare
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
hasAuthbinding could be simplified toproperty bool hasAuth: config && config.authsince QML will coerce the expression tobool, avoiding the somewhat opaque double negation. - Please double-check whether the change to the SPDX-FileCopyrightText year range (from 2024–2027 to 2024–2026) is intentional and consistent with project-wide licensing headers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `hasAuth` binding could be simplified to `property bool hasAuth: config && config.auth` since QML will coerce the expression to `bool`, avoiding the somewhat opaque double negation.
- Please double-check whether the change to the SPDX-FileCopyrightText year range (from 2024–2027 to 2024–2026) is intentional and consistent with project-wide licensing headers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
修复内容 / Fix
修复
dcc-network/qml/SystemProxyConfigItem.qml:17的运行时警告:根因 / Root Cause
SystemProxyConfigItem.qml:17顶层绑定property bool hasAuth: config.auth在组件实例化时立即求值。此时manualProxy数据经Qt::QueuedConnection跨线程异步投递尚未到达主线程,config仍为undefined,访问config.auth即抛 TypeError。数据到达后绑定重算,功能不受阻断,仅产生运行期警告噪声。改动 / Change
仅改动此单行,对
config为undefined/null时返回确定的false,数据到达后绑定自动重算。不涉及 C++ 或其他 QML 文件。验证 / Verification
SystemProxyConfigItem.qml:17的 TypeError关联 / Association
Summary by Sourcery
Guard the system proxy authentication binding against undefined configuration data.
Bug Fixes:
Chores: