-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(live-cursor): live cursor during collaboration #1775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR fixes a critical bug introduced in intermediate commits where environment detection variables (isProd, isDev, isTest, isHosted) were accidentally hardcoded to production values, breaking environment-specific behavior in development and test environments.
Key Changes:
- Restored dynamic environment detection using
env.NODE_ENVcomparisons - Re-added
getEnvimport that was removed in error - Fixed
isHostedcheck to properly evaluateNEXT_PUBLIC_APP_URLat runtime
The final commit (c603d82) successfully reverts the problematic hardcoded values introduced in commits 1e50175 and f1f067d, restoring the correct behavior that existed before this PR's earlier commits.
Confidence Score: 5/5
- This PR is safe to merge - it fixes a critical environment detection bug
- The changes correctly restore dynamic environment variable evaluation that was accidentally hardcoded in earlier commits. The implementation properly uses the existing
envandgetEnvutilities, matching the original working code before the PR. No logical errors or security issues introduced. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/environment.ts | 5/5 | Restored dynamic environment detection after hardcoded values were accidentally introduced in earlier commits |
Sequence Diagram
sequenceDiagram
participant App as Application Code
participant EnvModule as environment.ts
participant EnvUtil as env.ts (getEnv)
participant Process as process.env
participant Runtime as next-runtime-env
Note over App,Runtime: Environment Detection Flow
App->>EnvModule: Import isProd, isDev, isTest, isHosted
EnvModule->>EnvUtil: Access env.NODE_ENV
EnvUtil->>Runtime: runtimeEnv('NODE_ENV')
Runtime-->>EnvUtil: value or undefined
alt Runtime returns value
EnvUtil-->>EnvModule: NODE_ENV value
else Runtime returns undefined
EnvUtil->>Process: process.env.NODE_ENV
Process-->>EnvUtil: NODE_ENV value
EnvUtil-->>EnvModule: NODE_ENV value
end
EnvModule->>EnvModule: Compare NODE_ENV === 'production'/'development'/'test'
EnvModule-->>App: Boolean flags (isProd, isDev, isTest)
Note over App,Runtime: Hosted Detection Flow
App->>EnvModule: Check isHosted
EnvModule->>EnvUtil: getEnv('NEXT_PUBLIC_APP_URL')
EnvUtil->>Runtime: runtimeEnv('NEXT_PUBLIC_APP_URL')
Runtime-->>EnvUtil: URL or undefined
alt Runtime returns value
EnvUtil-->>EnvModule: NEXT_PUBLIC_APP_URL
else Runtime returns undefined
EnvUtil->>Process: process.env.NEXT_PUBLIC_APP_URL
Process-->>EnvUtil: NEXT_PUBLIC_APP_URL
EnvUtil-->>EnvModule: NEXT_PUBLIC_APP_URL
end
EnvModule->>EnvModule: Compare URL with sim.ai/staging.sim.ai
EnvModule-->>App: isHosted boolean
1 file reviewed, no comments
* feat(live-cursor): collaborative cursor * fix user avatar url rendering * simplify presence * fix env ts * fix lint * fix type mismatch
Summary
Live cursor during collaboration + User Avatar Stack to fetch avatar urls.
Type of Change
Testing
Tested manually. UI issues with safari for positioning of avatar stack. But this will be moved by @emir-karabeg.
Checklist