Fix file rendering timing on first launch - delay initialization until UI fully loads

- Added 500ms delay to renderer-ready signal to ensure all UI initialization completes before opening files
- Added 100ms delay in openFileFromPath to ensure main process doesn't send file before renderer is fully prepared
- Prevents race condition where files would open before theme is applied and interface is ready
- Files now render properly on first launch regardless of app startup time
- Improved startup UX by ensuring smooth file rendering
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
2025-10-26 14:02:49 +05:30
parent b326772518
commit 3ccf8d102e
2 changed files with 10 additions and 3 deletions
+5 -1
View File
@@ -1668,7 +1668,11 @@ function openFileFromPath(filePath) {
currentFile = filePath;
const content = fs.readFileSync(filePath, 'utf-8');
if (mainWindow && mainWindow.webContents && rendererReady) {
mainWindow.webContents.send('file-opened', { path: filePath, content });
// Add a small delay to ensure renderer is fully prepared to display the file
// This prevents timing issues where file opens before UI is ready
setTimeout(() => {
mainWindow.webContents.send('file-opened', { path: filePath, content });
}, 100);
} else {
// Store file to open after renderer is ready
app.pendingFile = filePath;