fix (desktop): flash render of setup script not setup#719
Conversation
📝 WalkthroughWalkthroughAdds optimistic initialization progress updates to workspace creation and delays/updates the interrupted-state UI for workspace initialization. The hook now sets a "Preparing..." optimistic progress entry when a created workspace is initializing. The initializing view defers showing the interrupted UI for 500ms and updates copy and icon styling. Changes
Sequence DiagramsequenceDiagram
participant User
participant Hook as useCreateWorkspace
participant API as CreateWorkspace API
participant ProgressStore as Progress Store
participant QueryCache as Query Cache
participant UI as WorkspaceInitializingView
User->>Hook: Request create workspace
Hook->>API: POST create workspace
API-->>Hook: Respond with workspace data (isInitializing: true)
alt isInitializing == true
Hook->>ProgressStore: updateProgress({workspaceId, projectId, step: "pending", message: "Preparing..."})
ProgressStore-->>UI: Emits optimistic progress
end
Hook->>QueryCache: Invalidate workspace queries
QueryCache-->>UI: Refreshed workspace list
UI->>User: Shows initializing state (delays interrupted UI by 500ms)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx (1)
47-56: Extract magic number to a named constant.The 500ms delay value should be extracted to a named constant at the module level for clarity and maintainability. As per coding guidelines, magic numbers should be named constants.
Suggested fix
Add constant at module top (after imports):
/** Delay before showing interrupted UI to avoid flash during normal creation */ const INTERRUPTED_UI_DELAY_MS = 500;Then update the effect:
useEffect(() => { if (isInterrupted && !progress) { - const timer = setTimeout(() => setShowInterruptedUI(true), 500); + const timer = setTimeout(() => setShowInterruptedUI(true), INTERRUPTED_UI_DELAY_MS); return () => clearTimeout(timer); } setShowInterruptedUI(false); }, [isInterrupted, progress]);
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined insrc/lib/trpc
Use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from@trpc/server/observableinstead of async generators, as the library explicitly checksisObservable(result)and throws an error otherwise
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid usinganytype - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
One component per file - do not create multi-component files
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
apps/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Drizzle ORM for all database operations - never use raw SQL
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome for formatting and linting - run at root level with
bun run lint:fixorbiome check --write
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (2)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx (2)
88-89: LGTM!The triple condition correctly gates the interrupted UI, ensuring it only shows after the delay has elapsed. This effectively prevents the flash during normal workspace creation when progress arrives quickly.
94-107: UI copy and styling updates look good.The updated messaging ("Setup incomplete", "Workspace setup didn't finish...") is clearer and less alarming than the previous warning-style presentation. The muted icon styling appropriately reflects that this is a recoverable state rather than an error.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.