fix(renderer): prevent welcome screen from overwriting opened markdown files

The welcome tab setup awaited getAppVersion() inside DOMContentLoaded.
While yielding, the renderer-ready timeout fired, file-opened was processed,
and openFile rendered the markdown. When the welcome setup resumed, it
overwrote tab.content and preview.innerHTML with the welcome screen,
leaving the preview blank.

Fix: only show the welcome screen if the tab is still empty (no filePath
and no content) when the async setup resumes.

Amit Haridas
This commit is contained in:
2026-06-03 15:14:41 +05:30
parent 0192590567
commit 272215f9af
+2 -1
View File
@@ -1730,7 +1730,8 @@ document.addEventListener('DOMContentLoaded', async () => {
const welcomeHtml = getCreateWelcomeContent()(recentFiles, appVersion);
const tab = tabManager.tabs.get(tabManager.activeTabId);
if (tab) {
// Only show welcome if no file was opened while we were awaiting
if (tab && !tab.filePath && tab.content === '') {
tab.title = 'Welcome';
tab.content = '';
const preview = document.getElementById(`preview-${tab.id}`);