Skip to content

Conversation

@MathurAditya724
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Dec 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
spotlightjs Skipped Skipped Dec 31, 2025 2:51pm

@MathurAditya724 MathurAditya724 marked this pull request as ready for review December 31, 2025 14:32
@MathurAditya724 MathurAditya724 requested a review from BYK December 31, 2025 14:32
Comment on lines +12 to +14
// Don't render at all outside Electron
if (!IS_ELECTRON || process.platform !== "darwin") {
return null;
Copy link

Choose a reason for hiding this comment

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

Bug: The code accesses process.platform in a React component. process is a Node.js global and is not defined in the Electron renderer, which will cause a ReferenceError.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The component ElectronDragbarSpacer attempts to access process.platform within its render logic. This code runs in the Electron renderer process, which is a browser environment where Node.js globals like process are not available. While the build configuration defines IS_ELECTRON, it does not polyfill the process object. In an Electron build, IS_ELECTRON is true, forcing the evaluation of process.platform. This will throw a ReferenceError: process is not defined and crash the application on startup, as the component is always rendered.

💡 Suggested Fix

The platform check should be performed in the Electron main process. The result can then be passed to the renderer process via IPC (Inter-Process Communication) or exposed on the window object using a preload script, making it safely accessible to the React component.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/spotlight/src/ui/ui/electronDragbarSpacer.tsx#L12-L14

Potential issue: The component `ElectronDragbarSpacer` attempts to access
`process.platform` within its render logic. This code runs in the Electron renderer
process, which is a browser environment where Node.js globals like `process` are not
available. While the build configuration defines `IS_ELECTRON`, it does not polyfill the
`process` object. In an Electron build, `IS_ELECTRON` is `true`, forcing the evaluation
of `process.platform`. This will throw a `ReferenceError: process is not defined` and
crash the application on startup, as the component is always rendered.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 8068884

Copy link
Member Author

Choose a reason for hiding this comment

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

We use this statement in electron for the value of isMac and also as we have checked on windows, this seems to be working

@MathurAditya724
Copy link
Member Author

For windows, this is how it looks rn but without the menu bar
image

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.

2 participants