-
Notifications
You must be signed in to change notification settings - Fork 78
feat(FR-1685): optimize network requests and loading states for Folder Explorer modal #4656
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
base: main
Are you sure you want to change the base?
feat(FR-1685): optimize network requests and loading states for Folder Explorer modal #4656
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🔴 | Statements | 49.62% | 132/266 |
| 🔴 | Branches | 29.96% | 80/267 |
| 🔴 | Functions | 33.33% | 20/60 |
| 🔴 | Lines | 51.95% | 120/231 |
Test suite run success
55 tests passing in 3 suites.
Report generated by 🧪jest coverage report action from 845dc36
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🔴 | Statements | 4.69% (+0.01% 🔼) |
547/11659 |
| 🔴 | Branches | 3.82% (+0.01% 🔼) |
314/8219 |
| 🔴 | Functions | 2.91% | 104/3576 |
| 🔴 | Lines | 4.64% (+0.01% 🔼) |
529/11400 |
Test suite run success
125 tests passing in 14 suites.
Report generated by 🧪jest coverage report action from 845dc36
7137ab8 to
fad679b
Compare
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.
Pull Request Overview
This PR optimizes network requests and improves loading state handling for the Folder Explorer modal by eliminating redundant GraphQL queries and enhancing transition UX.
Key changes:
- Removes waterfall GraphQL requests by passing folder data directly to
useFileUploadManagerinstead of fetching separately - Implements
useDeferredValuewith conditional fetch policy to prevent unnecessary network requests during React transitions - Adds
spinnerLoadingprop to BAITable for better loading state differentiation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| react/src/components/FolderExplorerModal.tsx | Implements deferred value and Suspense boundaries, moves useFileUploadManager call after GraphQL query to pass fetched data |
| react/src/components/FileUploadManager.tsx | Removes redundant GraphQL query, accepts id and folderName parameters directly, uses toLocalId for conversion |
| packages/backend.ai-ui/src/components/baiClient/FileExplorer/BAIFileExplorer.tsx | Implements conditional loading states (spinner vs opacity) based on cache presence |
| packages/backend.ai-ui/src/components/Table/BAITable.tsx | Adds spinnerLoading prop to support distinct spinner loading state |
| packages/backend.ai-ui/src/components/baiClient/FileExplorer/hooks.ts | Adjusts cache timing from 5 minutes to 3 seconds staleTime |
fad679b to
8ebf1de
Compare
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.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
react/src/components/SFTPServerButton.tsx:1
- Debug console.log statement removed.
import { App, Image, Tooltip } from 'antd';
packages/backend.ai-ui/src/components/baiClient/FileExplorer/BAIFileExplorer.tsx
Show resolved
Hide resolved
…r Explorer modal - Add spinnerLoading prop to BAITable for improved loading UX - Optimize FileUploadManager to remove unnecessary GraphQL query - Implement deferred loading and Suspense boundaries in FolderExplorerModal - Reduce waterfall requests by accepting folder info as parameters - Improve modal transition performance with optimized fetch policies
8ebf1de to
845dc36
Compare
agatha197
left a comment
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.
LGTM

This PR optimizes network requests and improves loading transitions for the Folder Explorer modal to provide better UX and reduce unnecessary API calls.
Changes
1. BAITable Component Enhancement
spinnerLoadingprop to BAITable for better loading state control2. FileUploadManager Optimization
FileUploadManagerQuery)useFileUploadManagerhook to acceptidandfolderNameparameters directlytoGlobalIdwithtoLocalIdfor more efficient ID handling3. FolderExplorerModal Improvements
useDeferredValuefor better transition handlingBenefits
Testing