Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: No error message prompted after QR code failure --bug=1052150 --user=王孝刚 【系统设置】钉钉二维码失效后,点击刷新,使用非当前组织的用户扫码登录,没有弹错误提示 https://www.tapd.cn/57709429/s/1653901

--bug=1052150 --user=王孝刚 【系统设置】钉钉二维码失效后,点击刷新,使用非当前组织的用户扫码登录,没有弹错误提示 https://www.tapd.cn/57709429/s/1653901
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 12, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 12, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

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

errorShown.value = true
}
}
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The provided code is generally well-written, but there are a few minor improvements and clarifications you can make:

  1. Typo: There seems to be an issue with the message being passed to MsgError. It's likely that it should not include the { errorMsg } syntax within single quotes.

  2. Redundancy: The line where errorShown.value = true; is followed by (errorMsg: string) => { ... };, which does not serve any purpose without more context about what this function does.

  3. Whitespace: Ensure consistent indentation throughout the codebase for better readability.

Here is the revised version of the code:

@@ -80,6 +80,7 @@ const errorShown = ref(false)
 const initActive = async () => {
   try {
     await load(true);
+    errorShown.value = false;
     if (!isConfigReady.value) {
       return;
     }
@@ -114,7 +115,7 @@ const initActive = async () => {
       (errorMsg: string) => {
         if (!errorShown.value) {
           MsgError(errorMsg); // Pass the error message directly
+          errorShown.value = true; // Set flag to indicate error has been shown
         }
       },
     );

Additional Comments:

  • Error Handling Flag: The errorShown.value = true; statement inside the callback ensures that each error message is only displayed once during its execution lifetime even if multiple error messages occur.

These changes improve clarity and maintainability of the code while ensuring it performs correctly.

@wxg0103 wxg0103 merged commit f4f47a8 into main Feb 12, 2025
4 of 5 checks passed
@wxg0103 wxg0103 deleted the pr@main@fix_1052150 branch February 12, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants