Skip to content

Commit a9913f1

Browse files
committed
feat: 添加首次切换到仪表盘时检查欢迎弹框的逻辑
避免在应用初始化时立即显示欢迎弹框导致的闪烁问题,改为在用户首次切换到仪表盘时再检查是否需要显示
1 parent e228d00 commit a9913f1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

frontend/src/App.svelte

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,24 @@
3535
3636
// 控制欢迎弹框是否可见(用于避免闪烁)
3737
let welcomeDialogReady = $state(false);
38+
let hasCheckedWelcomeDialog = $state(false);
3839
3940
// 当 rightClickDisabled 变化时更新同步变量
4041
$effect(() => {
4142
rightClickDisabledSync = rightClickDisabled;
4243
});
44+
45+
// 监听页面切换到仪表盘时检查欢迎弹框(只检查一次)
46+
$effect(() => {
47+
if (activeTab === 'dashboard' && !hasCheckedWelcomeDialog) {
48+
hasCheckedWelcomeDialog = true;
49+
GetShowWelcomeDialog().then(shouldShow => {
50+
if (shouldShow) {
51+
welcomeDialogReady = true;
52+
}
53+
}).catch(() => {});
54+
}
55+
});
4356
4457
let debugEnabled = $state(false);
4558
let isMaximised = $state(false);
@@ -195,11 +208,6 @@
195208
GetLanguage(),
196209
GetVersion()
197210
]);
198-
// Check if should show welcome dialog
199-
const shouldShowWelcome = await GetShowWelcomeDialog();
200-
if (shouldShowWelcome) {
201-
welcomeDialogReady = true;
202-
}
203211
rightClickDisabledSync = rightClickDisabled;
204212
debugEnabled = !!config.debugEnabled;
205213
} catch (e) {

0 commit comments

Comments
 (0)