[1288] 修复首次点击登录按钮看不到登录信息 - #4527
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
标题栏「领取会员」按钮右侧的登录(用户中心)按钮,第一次点击弹出的用户弹窗看不到登录信息(显示「未登录/非会员」占位内容),第二次点击才能看到登录信息。
根因
登录弹窗
LoginDialog为惰性创建(ensureLoginDialog(),约 100ms 开销,为不拖慢首屏而推迟到首次使用)。fetchUserInfo的网络回调里顺序反了:先updateDialogContent(往nameLabel/accountIdLabel等标签写用户信息),之后才ensureLoginDialog()创建弹窗。nullptr),写入被if (nameLabel)守卫全部跳过,弹窗只能显示默认占位内容;handleError分支同构:showNotLoggedInDialog写错误提示时标签也未创建,首次点击同样丢失「请重新登录」等错误信息。修复
fetchUserInfo回调成功分支:showDialog为 true 时先ensureLoginDialog(),再updateDialogContent,最后用已创建的m_loginDialog显示;handleError:同样先创建弹窗再写内容再显示;showDialog=false)行为不变,仍保持惰性创建优化。验证
xmake b stem增量编译通过;gf fmt --changed-since=main无格式问题;devel/1288.md。