Skip to content

Commit 58a2d0a

Browse files
committed
fix(LLBotConfig): use cached UIN from SelfInfoService for faster page availability
RefreshAsync now checks SelfInfoService.CurrentUin first before calling the PMHQ API. Since UinStream is a Subject (not ReplaySubject), late subscribers miss the initial push — using the cached value ensures the config page becomes editable as soon as the UIN is known.
1 parent 9d8df85 commit 58a2d0a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ViewModels/LLBotConfigViewModel.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,17 @@ public async Task RefreshAsync()
388388
{
389389
try
390390
{
391-
// 直接调用 API 获取 UIN,不依赖 ResourceMonitor 的缓存
391+
// 优先使用 SelfInfoService 已缓存的 UIN
392+
var cachedUin = _selfInfoService.CurrentUin;
393+
if (!string.IsNullOrEmpty(cachedUin))
394+
{
395+
_currentUin = cachedUin;
396+
HasUin = true;
397+
await LoadConfigAsync();
398+
return;
399+
}
400+
401+
// 缓存中没有,调用 API 获取
392402
var selfInfo = await _pmhqClient.FetchSelfInfoAsync();
393403
if (selfInfo != null && !string.IsNullOrEmpty(selfInfo.Uin))
394404
{

0 commit comments

Comments
 (0)