Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Live cursor during collaboration + User Avatar Stack to fetch avatar urls.

Type of Change

  • New feature

Testing

Tested manually. UI issues with safari for positioning of avatar stack. But this will be moved by @emir-karabeg.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 31, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 31, 2025 2:44am

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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_ENV comparisons
  • Re-added getEnv import that was removed in error
  • Fixed isHosted check to properly evaluate NEXT_PUBLIC_APP_URL at 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 env and getEnv utilities, 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
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit eac358b into staging Oct 31, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/live-cursor-sockets branch November 7, 2025 20:18
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
* feat(live-cursor): collaborative cursor

* fix user avatar url rendering

* simplify presence

* fix env ts

* fix lint

* fix type mismatch
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
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