Skip to content

fix (desktop): flash render of setup script not setup#719

Merged
AviPeltz merged 2 commits into
mainfrom
flash-reren
Jan 12, 2026
Merged

fix (desktop): flash render of setup script not setup#719
AviPeltz merged 2 commits into
mainfrom
flash-reren

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Jan 12, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features

    • Workspace creation now shows immediate progress with a "Preparing..." status so setup feedback appears right away.
  • Bug Fixes

    • Improved interrupted-setup behavior: the interrupted message is now delayed to avoid flicker, with updated wording and a muted icon; actions now read "retry" or "remove" for clarity.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Workspace creation hook
apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts
Adds import/use of updateProgress and WorkspaceInitProgress; on success, if data.isInitializing is true, writes an optimistic progress entry (workspaceId, projectId, step: "pending", message: "Preparing...") before invalidating workspace queries.
Initializing UI behavior
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceInitializingView/WorkspaceInitializingView.tsx
Adds useEffect to delay showing interrupted UI by 500ms (showInterruptedUI), changes interrupted-state icon to a muted branch icon, updates copy from "Setup was interrupted" → "Setup incomplete" and associated description/action labels, and conditions rendering on showInterruptedUI.

Sequence Diagram

sequenceDiagram
    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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
A tiny hop, a task begun,
"Preparing..." hums before the sun.
I plant a progress, soft and quick,
Delay the frown, make setup slick.
✨🥕

🚥 Pre-merge checks | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it contains only the template structure with most sections left blank, including Description, Related Issues, Testing, and Additional Notes. Fill in the Description section explaining the optimistic progress handling and interrupted state display logic, add Related Issues links, and provide testing steps to verify the fix works correctly.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is unclear and contains a grammatical error; 'flash render of setup script not setup' is vague and difficult to understand without additional context. Clarify the title to better describe the actual change, such as 'fix (desktop): add delayed display for interrupted workspace setup state' to accurately reflect the modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 425cae4 and 6bda2c8.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts
  • apps/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 in src/lib/trpc
Use alias as defined in tsconfig.json when 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/observable instead of async generators, as the library explicitly checks isObservable(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 using any type - 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:fix or biome 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.

@AviPeltz AviPeltz merged commit 6155c60 into main Jan 12, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant