Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Sep 26, 2025

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Additional Options

  • [Optional] Override Linear Check

Summary by cubic

Server-side render the user’s projects and pass them through ChatContext to speed up first load and keep projects consistent across pages. Also polish the chat sidebar and input/file controls for cleaner spacing and hover behavior.

  • Refactors

    • Fetch projects on the server (fetchChatData) and inject into ChatContext; ProjectsProvider now accepts initialProjects and only fetches recent files on mount.
    • Renamed the user files worker to user_file_processing and added user_file_project_sync; updated the dev background jobs script accordingly.
  • UX Tweaks

    • Tightened sidebar layout: moved Projects below Assistants, improved padding/scrolling, and removed the chat session slide-in animation.
    • Polished controls: consistent trigger height and hover styles for FilePicker and ChatInputOption, cursor-pointer on “Upload Files,” and small spacing fixes in PagesTab and Projects.

@Weves Weves requested a review from a team as a code owner September 26, 2025 21:47
Copy link

vercel bot commented Sep 26, 2025

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

Project Deployment Preview Comments Updated (UTC)
internal-search Ready Ready Preview Comment Sep 26, 2025 9:50pm

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

Summary

This PR implements small UX improvements for the projects feature, primarily optimizing data loading and enhancing visual styling. The main changes include:

  • Improved data flow: Projects are now fetched during SSR in fetchChatData.ts and passed through the component hierarchy, eliminating unnecessary client-side fetches and loading states
  • Better component architecture: Moved ProjectsProvider from page level to a more appropriate location in WrappedChat.tsx and added support for pre-loaded projects data
  • Enhanced styling: Added cn utility usage for better className management, improved hover effects and transitions in input components
  • Sidebar reorganization: Moved Projects section below Assistants in the sidebar for better information hierarchy
  • Backend refactoring: Updated Celery worker naming from user_files_indexing to user_file_processing for consistency

The changes focus on user experience improvements without introducing breaking changes to the core functionality.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The changes are primarily UI/UX improvements and data flow optimizations without complex logic changes. Only minor issue is a console.log statement that should be removed.
  • Pay attention to web/src/lib/chat/fetchChatData.ts to remove the console.log statement

Important Files Changed

File Analysis

Filename        Score        Overview
web/src/app/chat/projects/ProjectsContext.tsx 4/5 Added initial projects prop to prevent unnecessary fetch on load, optimized initialization
web/src/lib/chat/fetchChatData.ts 4/5 Added projects fetch to SSR data loading, improved error handling with console logging
web/src/app/chat/WrappedChat.tsx 5/5 Added ProjectsProvider with initial projects data, improved component architecture
web/src/components/sidebar/HistorySidebar.tsx 5/5 Reorganized sidebar layout, moved Projects below Assistants section
backend/scripts/dev_run_background_jobs.py 5/5 Renamed worker from user_files_indexing to user_file_processing, updated queue names

Sequence Diagram

sequenceDiagram
    participant Page as Chat Page
    participant Layout as Chat Layout  
    participant FetchData as fetchChatData
    participant API as Backend API
    participant Context as ChatContext
    participant Provider as ProjectsProvider
    participant Projects as Projects Component

    Page->>Layout: Request chat layout
    Layout->>FetchData: fetchChatData()
    FetchData->>API: GET /user/projects/
    API-->>FetchData: projects[]
    FetchData-->>Layout: {projects, ...otherData}
    Layout->>Context: Pass projects via ChatContext
    Context->>Page: Render with projects data
    Page->>Provider: ProjectsProvider(initialProjects=projects)
    Note over Provider: No longer fetches projects on mount
    Provider->>Provider: setState(initialProjects)
    Provider->>Projects: Render with pre-loaded data
    Note over Projects: Improved UX - no loading state needed
Loading

16 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +111 to +112
} else {
console.log("Failed to fetch projects");
Copy link
Contributor

Choose a reason for hiding this comment

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

style: console.log statement should be removed before production merge
Context Used: Rule - Remove temporary debugging code before merging to production, especially tenant-specific debugging logs. (link)

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/lib/chat/fetchChatData.ts
Line: 111:112

Comment:
style: console.log statement should be removed before production merge
**Context Used:** **Rule -** Remove temporary debugging code before merging to production, especially tenant-specific debugging logs. ([link](https://app.greptile.com/review/custom-context?memory=b39fa59b-2568-4dd3-9576-83b46251a7b8))

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 17 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="web/src/app/chat/projects/ProjectsContext.tsx">

<violation number="1" location="web/src/app/chat/projects/ProjectsContext.tsx:268">
Removing the initial fetchProjects call leaves projects stuck at the initialProjects prop. Existing pages still mount &lt;ProjectsProvider&gt; without initialProjects, so the projects list never loads for them.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

setIsLoading(true);
Promise.all([fetchProjects(), getRecentFiles()])
.then(([, recent]) => {
getRecentFiles()
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 26, 2025

Choose a reason for hiding this comment

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

Removing the initial fetchProjects call leaves projects stuck at the initialProjects prop. Existing pages still mount without initialProjects, so the projects list never loads for them.

Prompt for AI agents
Address the following comment on web/src/app/chat/projects/ProjectsContext.tsx at line 268:

<comment>Removing the initial fetchProjects call leaves projects stuck at the initialProjects prop. Existing pages still mount &lt;ProjectsProvider&gt; without initialProjects, so the projects list never loads for them.</comment>

<file context>
@@ -261,17 +263,17 @@ export const ProjectsProvider: React.FC&lt;ProjectsProviderProps&gt; = ({
     setIsLoading(true);
-    Promise.all([fetchProjects(), getRecentFiles()])
-      .then(([, recent]) =&gt; {
+    getRecentFiles()
+      .then((recent) =&gt; {
         setRecentFiles(recent);
</file context>
Fix with Cubic

@Weves Weves merged commit 98554e5 into main Sep 26, 2025
58 of 62 checks passed
@Weves Weves deleted the small-improvements branch September 26, 2025 22:33
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.

1 participant