chore: fix rerenders on files#3805
Conversation
PR SummaryMedium Risk Overview Adds a 200ms debounced search input and introduces lightweight row caching so Refactors preview-mode initialization and route-change handling to avoid effect churn, and extracts the file row context menu into a memoized component; Written by Cursor Bugbot for commit 3750f6e. Configure here. |
|
@adithyaakrishna is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR applies a broad set of memoization and ref-stabilization optimizations to the files page to reduce unnecessary re-renders. The changes include debounced search with immediate UI feedback, row caching via Confidence Score: 4/5Safe to merge after addressing the concurrent-mode ref-mutation issue in The PR delivers a large, well-structured rerender optimization. The two remaining findings are both in apps/sim/app/workspace/[workspaceId]/files/files.tsx — specifically the render-time Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User types in search box] --> B[setInputValue - immediate]
B --> C[Debounce timer 200ms]
C --> D[setDebouncedSearchTerm]
D --> E[filteredFiles useMemo recalculates]
E --> F{Row in rowCacheRef?}
F -- Yes, same file+members --> G[Return cached ResourceRow]
F -- No --> H[Build new ResourceRow]
G & H --> I[baseRows array]
I --> J{listRename.editingId set?}
J -- No --> K[rows = baseRows]
J -- Yes --> L[Inject InlineRenameInput into matching row]
L --> K
K --> M[Resource table renders]
N[fileIdFromRoute changes] --> O{prevFileIdRef check during render}
O -- Different --> P[Mutate prevFileIdRef.current]
P --> Q[Compute nextMode via filesRef.current]
Q --> R[setPreviewMode if different]
O -- Same --> S[No-op]
style P fill:#f9c,stroke:#c00
style R fill:#ffc,stroke:#990
Reviews (2): Last reviewed commit: "chore: fix review changes" | Re-trigger Greptile |
c5ee461 to
3750f6e
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@greptile |
|
@cursor review |
Summary
Type of Change
Testing
Checklist