Move sidebar and offline imports to lazy loading
This commit is contained in:
+12
-3
@@ -2,7 +2,7 @@
|
||||
import { state } from './state.js';
|
||||
import { t } from './i18n.js';
|
||||
import { showToast } from './ui.js';
|
||||
import { api } from './auth.js';
|
||||
import { api, AuthManager } from './auth.js';
|
||||
import { loadVaults, loadTags, refreshTagsForContext, refreshSidebarTreePreservingState } from './sidebar.js';
|
||||
import { loadRecentFiles, initAboutModal } from './config.js';
|
||||
import { openFile } from './viewer.js';
|
||||
@@ -591,8 +591,17 @@ export function init() {
|
||||
initOffline();
|
||||
initThemes();
|
||||
initAboutModal();
|
||||
// Sync file index after a short delay (let vaults load first)
|
||||
setTimeout(() => syncFileIndexFromServer(), 3000);
|
||||
// Sync file index after a short delay (let vaults load first).
|
||||
// Gate on auth at execution time (not scheduling time) so that
|
||||
// initAuth() has a chance to complete and set _authEnabled / token.
|
||||
// The login handler triggers syncFileIndexFromServer explicitly on
|
||||
// fresh login, so we only do it here for already-authenticated or
|
||||
// auth-disabled sessions.
|
||||
setTimeout(() => {
|
||||
if (!AuthManager._authEnabled || AuthManager.getToken()) {
|
||||
syncFileIndexFromServer();
|
||||
}
|
||||
}, 3000);
|
||||
initDashboardTabs();
|
||||
|
||||
// Listen for Forge editor rename events
|
||||
|
||||
Reference in New Issue
Block a user