Repository navigation
perf(renderer): lazy load Linear setup dialog - #11687
Conversation
Greptile SummaryThis PR lazy-loads
Confidence Score: 4/5Safe to merge. The lazy-loading boundary is well-tested, all existing close/snooze/success flows are preserved, and the lazyWithRetry stale-chunk recovery path is unchanged. The core logic is straightforward: the dialog is now mounted on demand instead of kept in the DOM with a closed state. The logic is covered by a thorough test suite that was updated to await the lazy chunk. The only tradeoff is that Radix UI's exit animation no longer fires when the dialog closes, since the component tree is unmounted before Radix can animate it out — but this is an accepted pattern for other lazy dialogs in the codebase. Files Needing Attention: No files require special attention. The prompt component change is the most impactful but is well-exercised by the updated tests.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.tsx | Core change: replaces static import with lazyWithRetry, gates dialog mount on setupDialogOpen, and wraps in Suspense. Logic is correct but the immediate unmount pattern forfeits Radix Dialog's CSS exit animation. |
| src/renderer/src/components/sidebar/LinearAgentSkillSetupDialog.tsx | Adds export default LinearAgentSkillSetupDialog to satisfy React.lazy's default-export contract; the named export is preserved for backward compatibility. |
| src/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.test.tsx | Updated to await the lazy dialog chunk before asserting dialog content, adds settleRender() calls after click events that open the dialog, and renames one test description to reflect lazy-load semantics. |
| src/renderer/src/app-startup-routing.test.ts | Adds a source-level assertion that LinearAgentSkillSetupPrompt.tsx uses a dynamic import (not a static one) and mounts the dialog inside Suspense, acting as a ratchet against accidental re-eagerness. |
Sequence Diagram
sequenceDiagram
participant User
participant Prompt as LinearAgentSkillSetupPrompt
participant Suspense as React Suspense
participant Lazy as lazyWithRetry
participant Dialog as LinearAgentSkillSetupDialog (chunk)
Note over Prompt: Renderer startup — Dialog chunk NOT loaded
Prompt->>Prompt: "render inline prompt (setupDialogOpen=false)"
User->>Prompt: click "Set up"
Prompt->>Prompt: setSetupDialogOpen(true)
Prompt->>Suspense: "mount Suspense fallback=null"
Suspense->>Lazy: trigger dynamic import('./LinearAgentSkillSetupDialog')
Note over Suspense: fallback=null while chunk loads
Lazy-->>Suspense: chunk loaded (with retry on failure)
Suspense->>Dialog: "mount LinearAgentSkillSetupDialog open=true"
Dialog-->>User: dialog visible
User->>Dialog: close (Escape / x / outside click)
Dialog->>Prompt: onOpenChange(false)
Prompt->>Prompt: setSetupDialogOpen(false)
Prompt->>Suspense: unmount entire Suspense+Dialog tree
Note over Dialog: Dialog removed immediately (no exit animation)
Reviews (1): Last reviewed commit: "perf(renderer): lazy load Linear setup d..." | Re-trigger Greptile
| const setupDialog = setupDialogOpen ? ( | ||
| <Suspense fallback={null}> | ||
| <LinearAgentSkillSetupDialog | ||
| open | ||
| showSuccess={showSuccessModal} | ||
| successDescription={successDescription} | ||
| missingLabel={missingLabel} | ||
| command={command} | ||
| installedCommand={installedCommand} | ||
| terminalShellOverride={terminalShellOverride} | ||
| installed={skill.installed} | ||
| loading={showCheckingModal || cliLoading || skill.loading} | ||
| error={skill.error} | ||
| getPrerequisiteStatus={ | ||
| agentRuntime.runtime === 'wsl' | ||
| ? await ensureWslCliAvailableForAgentSkillTerminal(agentRuntime) | ||
| : await ensureOrcaCliAvailableForAgentSkillTerminal({ | ||
| onStatusChange: (nextCliStatus) => { | ||
| writeIfCurrent(() => setCliStatus(nextCliStatus)) | ||
| } | ||
| }) | ||
| if (agentRuntime.runtime === 'wsl') { | ||
| writeIfCurrent(() => setCliStatus(nextStatus)) | ||
| } | ||
| }} | ||
| onRecheck={async () => { | ||
| if (surface === 'modal') { | ||
| setActiveSetupCheckIdentity(setupCheckIdentity) | ||
| setSetupCheckResult('checking') | ||
| await Promise.all([refreshCliStatus(), skill.refresh()]) | ||
| return | ||
| ? () => window.api.cli.getWslInstallStatus(getWslCliDistroRequest(agentRuntime)) | ||
| : undefined | ||
| } | ||
| await refreshCliStatus() | ||
| await skill.refresh() | ||
| }} | ||
| onOpenChange={(open) => { | ||
| if (open) { | ||
| setSetupDialogOpen(true) | ||
| return | ||
| } | ||
| if (showSuccessModal) { | ||
| closeSuccessModal() | ||
| return | ||
| } | ||
| if (surface === 'modal') { | ||
| snoozeForSession() | ||
| return | ||
| } | ||
| setSetupDialogOpen(false) | ||
| }} | ||
| onDismissPermanently={dismissPermanently} | ||
| onDone={closeSuccessModal} | ||
| /> | ||
| ) | ||
| onBeforeOpenTerminal={async () => { | ||
| const requestIdentity = setupCheckIdentity | ||
| const writeIfCurrent = (write: () => void): void => { | ||
| writeCliStatusForIdentity(requestIdentity, write) | ||
| } | ||
| const nextStatus = | ||
| agentRuntime.runtime === 'wsl' | ||
| ? await ensureWslCliAvailableForAgentSkillTerminal(agentRuntime) | ||
| : await ensureOrcaCliAvailableForAgentSkillTerminal({ | ||
| onStatusChange: (nextCliStatus) => { | ||
| writeIfCurrent(() => setCliStatus(nextCliStatus)) | ||
| } | ||
| }) | ||
| if (agentRuntime.runtime === 'wsl') { | ||
| writeIfCurrent(() => setCliStatus(nextStatus)) | ||
| } | ||
| }} | ||
| onRecheck={async () => { | ||
| if (surface === 'modal') { | ||
| setActiveSetupCheckIdentity(setupCheckIdentity) | ||
| setSetupCheckResult('checking') | ||
| await Promise.all([refreshCliStatus(), skill.refresh()]) | ||
| return | ||
| } | ||
| await refreshCliStatus() | ||
| await skill.refresh() | ||
| }} | ||
| onOpenChange={(open) => { | ||
| if (open) { | ||
| setSetupDialogOpen(true) | ||
| return | ||
| } | ||
| if (showSuccessModal) { | ||
| closeSuccessModal() | ||
| return | ||
| } | ||
| if (surface === 'modal') { | ||
| snoozeForSession() | ||
| return | ||
| } | ||
| setSetupDialogOpen(false) | ||
| }} | ||
| onDismissPermanently={dismissPermanently} | ||
| onDone={closeSuccessModal} | ||
| /> | ||
| </Suspense> | ||
| ) : null |
There was a problem hiding this comment.
Close animation lost on unmount
Because the dialog is now unmounted immediately when setupDialogOpen becomes false (rather than transitioning via open={false}), Radix UI never gets to run its CSS exit animation — the overlay and content disappear instantly. The other lazy dialogs in the codebase (e.g. AddProjectFromFolderDialog) appear to accept this same tradeoff, so this is consistent with the established pattern, but it's worth a deliberate confirmation that the snap-close is acceptable for this dialog.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe Linear agent skill setup dialog now uses retry-enabled lazy loading and renders inside ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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 |
Summary
Lazy-load the Linear agent skill setup dialog only when the prompt opens it.
This removes the setup implementation and its transitive dependencies from the main renderer startup graph while preserving the established
lazyWithRetrystale-chunk recovery behavior.Fresh A/B Electron builds against the same
mainbaseline measured:The popout entry tradeoff comes from exposing the dialog as a separate lazy chunk; the primary renderer startup win is substantially larger.
Screenshots
No visual change.
Testing
pnpm lint(targetedoxlint --deny-warningspassed)pnpm typecheck(pnpm run typecheck:webpassed)pnpm test(4 focused test files, 61 tests passed)pnpm build(fresh baseline and branch Electron builds passed)Also passed targeted formatting, max-lines ratchet, and
git diff --check.AI Review Report
Reviewed the lazy boundary, modal lifecycle, retry behavior, and test coverage. The dialog is mounted only while open, existing close/snooze/success flows remain unchanged, and
lazyWithRetryretains stale-chunk recovery.Cross-platform review found no changed shortcuts, labels, paths, shell behavior, native modules, or Electron platform branching. Existing native and WSL prerequisite paths are preserved.
Security Audit
No new input, command, path, authentication, secret, dependency, or IPC surface is introduced. Existing CLI prerequisite checks and terminal-opening callbacks are moved behind the lazy boundary without behavior changes.
Notes
This is the first focused extraction from draft PR #11539. It is independent and based directly on
main.