Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

@waleedlatif1 waleedlatif1 commented Nov 11, 2025

Summary

  • add missing deps, fix access patterns, update dockerfiles, updated turborepo

Fixes #1890

Type of Change

  • Bug fix

Testing

Tested manually, drastically reduce build time for dockerfiles

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 Nov 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Nov 11, 2025 7:35pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 11, 2025

Greptile Overview

Greptile Summary

This PR addresses multiple installation and build issues reported in #1890. The changes fix infinite loop bugs in React hooks, add missing dependencies, optimize Docker builds, and upgrade turborepo.

Key Changes

  • Fixed infinite loop in usage-indicator.tsx by calling loadData() directly from store state instead of including it in useEffect dependencies
  • Fixed similar infinite loop in use-knowledge.ts by removing unnecessary isMounted state tracking
  • Added nanoid package that was missing but used throughout the codebase (webhooks, API routes)
  • Replaced nanoid with Node.js crypto.randomBytes() for API key generation in service.ts to reduce dependencies
  • Improved Docker build caching by including turbo.json and packages/db/package.json in Dockerfiles
  • Upgraded turborepo from 2.6.0 to 2.6.1

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes are well-targeted bug fixes and dependency updates. The infinite loop fixes use proper Zustand store access patterns. The nanoid addition resolves missing dependency errors. Docker optimizations improve build performance without changing functionality. The turborepo upgrade is a minor version bump. No breaking changes or risky refactors.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/usage-indicator/usage-indicator.tsx 5/5 Fixed infinite loop by calling loadData directly from store state instead of using it as dependency
apps/sim/hooks/use-knowledge.ts 5/5 Removed unnecessary isMounted tracking; simplified client-side chunk loading logic
apps/sim/lib/api-key/service.ts 5/5 Replaced nanoid with Node.js crypto randomBytes for API key generation
docker/app.Dockerfile 5/5 Added turbo.json and packages/db/package.json to improve Docker build caching
docker/realtime.Dockerfile 5/5 Added turbo.json and packages/db/package.json to improve Docker build caching

Sequence Diagram

sequenceDiagram
    participant User
    participant UsageIndicator
    participant SubscriptionStore
    participant API
    
    Note over User,API: Fixed Infinite Loop Issue
    
    User->>UsageIndicator: Component Mount
    UsageIndicator->>SubscriptionStore: getState().loadData()
    Note right of UsageIndicator: Direct state access<br/>prevents re-renders
    
    SubscriptionStore->>SubscriptionStore: Check cache validity
    alt Cache valid
        SubscriptionStore-->>UsageIndicator: Return cached data
    else Cache invalid or missing
        SubscriptionStore->>API: GET /api/subscription
        SubscriptionStore->>API: GET /api/usage
        API-->>SubscriptionStore: Subscription & usage data
        SubscriptionStore->>SubscriptionStore: Update state
        SubscriptionStore-->>UsageIndicator: Return fresh data
    end
    
    UsageIndicator->>SubscriptionStore: getUsage()
    UsageIndicator->>SubscriptionStore: getSubscriptionStatus()
    SubscriptionStore-->>UsageIndicator: Current usage & subscription
    UsageIndicator->>User: Display usage indicator
    
    Note over User,API: Similar fix applied to use-knowledge.ts
    
    participant KnowledgeHook
    participant ChunkAPI
    
    User->>KnowledgeHook: Load document chunks
    KnowledgeHook->>ChunkAPI: Fetch chunks (paginated)
    Note right of KnowledgeHook: Removed isMounted checks<br/>simplified logic
    ChunkAPI-->>KnowledgeHook: Return chunks
    KnowledgeHook->>User: Display chunks
Loading

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.

7 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 1130bef into staging Nov 11, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/local branch November 11, 2025 20:02
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…, updated turborepo (#1895)

* fix(local): add missing deps, fix access patterns, update dockerfiles

* upgrade turborepo
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…, updated turborepo (#1895)

* fix(local): add missing deps, fix access patterns, update dockerfiles

* upgrade turborepo
@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