Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ gh pr view <number> --json mergeable,mergeStateStatus | jq '.'
./scripts/wait_pr_checks.sh <pr_number>
```

- Generally run `wait_pr_checks` after submitting a PR to ensure CI passes.
- Status decoding: `mergeable=MERGEABLE` clean; `CONFLICTING` needs resolution. `mergeStateStatus=CLEAN` ready, `BLOCKED` waiting for CI, `BEHIND` rebase, `DIRTY` conflicts.
- If behind: `git fetch origin && git rebase origin/main && git push --force-with-lease`.
- Never enable auto-merge or merge at all unless the user explicitly says "merge it".
Expand Down
34 changes: 6 additions & 28 deletions src/desktop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,7 @@ import assert from "@/common/utils/assert";
import { loadTokenizerModules } from "@/node/utils/main/tokenizer";

// React DevTools for development profiling
// Using require() instead of import since it's dev-only and conditionally loaded
interface Extension {
name: string;
id: string;
}

type ExtensionInstaller = (
ext: { id: string },
options?: { loadExtensionOptions?: { allowFileAccess?: boolean } }
) => Promise<Extension>;

let installExtension: ExtensionInstaller | null = null;
let REACT_DEVELOPER_TOOLS: { id: string } | null = null;

if (!app.isPackaged) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const devtools = require("electron-devtools-installer") as {
default: ExtensionInstaller;
REACT_DEVELOPER_TOOLS: { id: string };
};
installExtension = devtools.default;
REACT_DEVELOPER_TOOLS = devtools.REACT_DEVELOPER_TOOLS;
} catch (error) {
console.log("React DevTools not available:", error);
}
}
// Using dynamic import() to avoid loading electron-devtools-installer at module init time

// IMPORTANT: Lazy-load heavy dependencies to maintain fast startup time
//
Expand Down Expand Up @@ -509,8 +483,12 @@ if (gotTheLock) {
migrateLegacyMuxHome();

// Install React DevTools in development
if (!app.isPackaged && installExtension && REACT_DEVELOPER_TOOLS) {
if (!app.isPackaged) {
try {
// eslint-disable-next-line no-restricted-syntax
const { default: installExtension, REACT_DEVELOPER_TOOLS } = await import(
"electron-devtools-installer"
);
const extension = await installExtension(REACT_DEVELOPER_TOOLS, {
loadExtensionOptions: { allowFileAccess: true },
});
Expand Down