Conversation
|
|
||
| if (process.env.NODE_ENV === 'development') { | ||
| mainWindow.webContents.openDevTools({ mode: 'detach' }) | ||
| mainWindow.webContents.openDevTools({ mode: 'right' }) |
There was a problem hiding this comment.
This was my personal pain point - I would always close separate window and open sidebar, because it's just more comfortable for my debugging. If others prefer the detached window, I'll revert this change. Or perhaps we can make this remember personal preference.
There was a problem hiding this comment.
If we don't specify the mode it will remember the last setting you used.
| mainWindow.webContents.openDevTools({ mode: 'right' }) | |
| mainWindow.webContents.openDevTools() |
Everybody wins!
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Double
showWindowcall on macOS dock activation- Removed the redundant showWindow call in the activate event handler since the window is already shown by the ready-to-show event handler.
Or push these changes by commenting:
@cursor push 4d80d47564
Preview (4d80d47564)
diff --git a/src/main.ts b/src/main.ts
--- a/src/main.ts
+++ b/src/main.ts
@@ -175,8 +175,8 @@
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
- const mainWindow = await createWindow()
- showWindow(mainWindow)
+ await createWindow()
+ // Window is already shown by the 'ready-to-show' event handler
}
})You can send follow-ups to this agent here.
Co-authored-by: Edgar Fisher <e-fisher@users.noreply.github.com> Applied via @cursor push command
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Duplicated delayed spinner logic across two components
- Created a new useDelayedVisibility hook that abstracts the delayed spinner logic and updated both components to use it.
Or push these changes by commenting:
@cursor push 6f580056c9
Preview (6f580056c9)
diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx
--- a/src/components/Layout/Layout.tsx
+++ b/src/components/Layout/Layout.tsx
@@ -2,28 +2,19 @@
import { Box, Flex, IconButton, Spinner } from '@radix-ui/themes'
import { Allotment } from 'allotment'
import { PanelLeftOpenIcon } from 'lucide-react'
-import { Suspense, useEffect, useState } from 'react'
+import { Suspense, useEffect } from 'react'
import { Outlet, useLocation } from 'react-router-dom'
import { useLocalStorage } from 'react-use'
+import { useDelayedVisibility } from '@/hooks/useDelayedVisibility'
import { useListenDeepLinks } from '@/hooks/useListenDeepLinks'
import { ActivityBar } from './ActivityBar'
import { Sidebar } from './Sidebar'
function RouteLoadingFallback() {
- const [showSpinner, setShowSpinner] = useState(false)
+ const showSpinner = useDelayedVisibility()
- useEffect(() => {
- const timeout = setTimeout(() => {
- setShowSpinner(true)
- }, 50)
-
- return () => {
- clearTimeout(timeout)
- }
- }, [])
-
return (
<Flex
align="center"
diff --git a/src/components/Layout/View.tsx b/src/components/Layout/View.tsx
--- a/src/components/Layout/View.tsx
+++ b/src/components/Layout/View.tsx
@@ -1,23 +1,14 @@
import { css } from '@emotion/react'
import { Flex, Spinner } from '@radix-ui/themes'
-import { PropsWithChildren, ReactNode, useEffect, useState } from 'react'
+import { PropsWithChildren, ReactNode } from 'react'
+import { useDelayedVisibility } from '@/hooks/useDelayedVisibility'
+
import { ViewHeading } from './ViewHeading'
function LoadingSpinner() {
- const [showSpinner, setShowSpinner] = useState(false)
+ const showSpinner = useDelayedVisibility()
- useEffect(() => {
- // Only show the spinner if loading takes more than 50ms to avoid flickering
- const timeout = setTimeout(() => {
- setShowSpinner(true)
- }, 50)
-
- return () => {
- clearTimeout(timeout)
- }
- }, [])
-
return (
<Flex
css={css`
diff --git a/src/hooks/useDelayedVisibility.ts b/src/hooks/useDelayedVisibility.ts
new file mode 100644
--- /dev/null
+++ b/src/hooks/useDelayedVisibility.ts
@@ -1,0 +1,24 @@
+import { useEffect, useState } from 'react'
+
+/**
+ * Hook that delays showing a component until a specified delay has passed.
+ * Useful for preventing flickering of loading states for quick operations.
+ *
+ * @param delayMs The delay in milliseconds before showing the component
+ * @returns A boolean indicating whether the component should be visible
+ */
+export function useDelayedVisibility(delayMs = 50) {
+ const [isVisible, setIsVisible] = useState(false)
+
+ useEffect(() => {
+ const timeout = setTimeout(() => {
+ setIsVisible(true)
+ }, delayMs)
+
+ return () => {
+ clearTimeout(timeout)
+ }
+ }, [delayMs])
+
+ return isVisible
+}
\ No newline at end of fileYou can send follow-ups to this agent here.
…ty hook Co-authored-by: Edgar Fisher <e-fisher@users.noreply.github.com> Applied via @cursor push command
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Unrelated devtools mode change bundled in feature PR
- Reverted the DevTools mode from 'right' back to 'detach' to maintain consistency with the team's established development environment.
Or push these changes by commenting:
@cursor push 0e8604b911
Preview (0e8604b911)
diff --git a/src/main.ts b/src/main.ts
--- a/src/main.ts
+++ b/src/main.ts
@@ -115,7 +115,7 @@
replayPendingDeepLink()
if (process.env.NODE_ENV === 'development') {
- mainWindow.webContents.openDevTools({ mode: 'right' })
+ mainWindow.webContents.openDevTools({ mode: 'detach' })
}
mainWindow.on('closed', () =>You can send follow-ups to this agent here.
allansson
left a comment
There was a problem hiding this comment.
Really snappy startup now. ❤️
I would like to update the title of the PR to e.g. "feat: Improved startup time". I think it better captures why a user should be excited about the change.
I build a test version of the app and tested on Apple Silicon. Everything worked fine for me.
| let pendingDeepLink: string | null = null | ||
| let deepLinkCallback: ((url: string) => void) | null = null | ||
|
|
||
| ipcRenderer.on(AppHandler.DeepLink, (_, url: string) => { |
There was a problem hiding this comment.
This isn't a change request, but more like a bit of documentation.
When doing my workspace hackathon I needed to update the frontend route from the backend. Cursor chose to reuse the DeepLink handler to do so.
So this is actually more of a ChangeRoute handler. 🤔
|
|
||
| if (process.env.NODE_ENV === 'development') { | ||
| mainWindow.webContents.openDevTools({ mode: 'detach' }) | ||
| mainWindow.webContents.openDevTools({ mode: 'right' }) |
There was a problem hiding this comment.
If we don't specify the mode it will remember the last setting you used.
| mainWindow.webContents.openDevTools({ mode: 'right' }) | |
| mainWindow.webContents.openDevTools() |
Everybody wins!
going-confetti
left a comment
There was a problem hiding this comment.
Great improvement 🚢
Also closes #1068


Description
Remove the splash screen window and replace it with a lightweight inline loading indicator in
index.html. Routes are now lazy-loaded withReact.lazy, so the renderer starts faster by deferring heavy view imports.What changed:
BrowserWindow-based splash screen and all associated code (IPC handler, preload API, hook, SVG assets, HTML file)index.html(supports dark mode) as the initial loading stateHome,Recorder,Generator, etc.) with aSuspensefallback spinner in theLayoutready-to-showinstead of waiting for a renderer-to-main IPC round tripSplashscreenCloseIPC event to afterloadURLresolvesTime from
npm startto app ready state was cut from ~20s to ~10s on my machine.How to Test
npm startand verify the app loads with a brief spinner, then shows the home viewI've also created a custom build to verify deep links work as expected - confirmed by clicking "Start recording" from new test page in GCk6
Checklist
Related PR(s)/Issue(s)
Resolves #1068
Note
Medium Risk
Medium risk because it changes Electron startup/window-show timing, IPC deep-link delivery, and route loading behavior, which could impact navigation and protocol-link handling across platforms.
Overview
Improves perceived startup performance by removing the separate
BrowserWindowsplash screen and replacing it with a lightweight inline spinner inindex.html(with dark-mode styling).Defers renderer work by lazy-loading the main route views via
React.lazyand wrapping the routed outlet inSuspensewith a delayed spinner fallback.Simplifies startup/IPC flow by deleting splashscreen IPC APIs/assets and showing the main window on
ready-to-show; deep links are now replayed after the main window finishes loading and are delivered via the newapp:navigatechannel with buffering in preload to avoid missing early events.Reviewed by Cursor Bugbot for commit 2ff3cd8. Bugbot is set up for automated code reviews on this repo. Configure here.