mirror of
https://github.com/Silentely/eSIM-Tools.git
synced 2026-09-03 06:24:20 +08:00
🐛 fix: 修复异步生成二维码前未清空旧容器导致的显示不一致问题
- 在调用 generateQRCode 前先清空旧二维码容器 - 防止异步生成期间旧二维码和新 LPA 字符串不一致 - 修复 Session 恢复或重试时可能扫描到错误二维码的问题 影响模块: - src/giffgaff/js/modules/ui-controller.js (showESimResult) - src/simyo/js/modules/ui-controller.js (showQRResult) 问题来源:Bot 代码审查 (coderabbitai + cubic-dev-ai) P2 级别问题
This commit is contained in:
@@ -552,6 +552,8 @@ export class UIController {
|
||||
});
|
||||
}
|
||||
|
||||
// 清空旧二维码容器,防止异步生成期间显示过期内容
|
||||
this.elements.qrcode.replaceChildren();
|
||||
// 生成二维码(放在最后,即使失败也不影响 LPA 文本显示)
|
||||
// async 函数需要 await 或 .catch() 处理,避免 unhandled promise rejection
|
||||
this.generateQRCode(state.lpaString).catch((error) => {
|
||||
|
||||
@@ -403,6 +403,8 @@ export class UIController {
|
||||
this.elements.resultContainer.style.display = 'block';
|
||||
this.elements.resultContainer.classList.add('active');
|
||||
|
||||
// 清空旧二维码容器,防止异步生成期间显示过期内容
|
||||
this.elements.qrcode.replaceChildren();
|
||||
// generateQRCode 内部已处理所有错误,无需外部 .catch()
|
||||
this.generateQRCode(lpaString);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user