Skip to content

GitHub IPC handlers redundantly dynamic-import path #4360

@gregpriday

Description

@gregpriday

Two GitHub IPC handlers (handleGitHubGetRepoStats and handleGitHubGetProjectHealth) dynamically import path and fs/promises inside their handler bodies, even though path is already statically imported at the top of the same file.

// Line 2 — static import
import path from "path";

// Lines 66-68 inside handleGitHubGetRepoStats
const fs = await import("fs/promises");
const pathModule = await import("path");

// Lines 123-125 inside handleGitHubGetProjectHealth — same thing
const fs = await import("fs/promises");
const pathModule = await import("path");

The static path is used for validation (path.isAbsolute(cwd)) in the same handlers, while the dynamic pathModule is used for pathModule.resolve(cwd) — two references to the same module in the same function.

Dynamic imports of Node built-ins add unnecessary microtask overhead on every IPC call with zero lazy-loading benefit. The fs/promises import should also be hoisted to a static import since it's a built-in with no startup cost.

See electron/ipc/handlers/github.ts — static import at line 2, dynamic re-imports at lines 66-68 and 123-125.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions