Skip to content

Conversation

@yomybaby
Copy link
Member

@yomybaby yomybaby commented Nov 17, 2025

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

  • Added spinnerLoading prop to BAITable for better loading state control
  • Implemented LoadingOutlined icon for visual feedback during loading states
  • Applied spinner loading to FileExplorer component

2. FileUploadManager Optimization

  • Removed unnecessary GraphQL query (FileUploadManagerQuery)
  • Changed useFileUploadManager hook to accept id and folderName parameters directly
  • Replaced toGlobalId with toLocalId for more efficient ID handling

3. FolderExplorerModal Improvements

  • Implemented useDeferredValue for better transition handling
  • Added Suspense boundaries with Skeleton fallback for loading states
  • Optimized GraphQL fetch policy to prevent unnecessary requests during React transitions
  • Improved modal styling and layout for better user experience

Benefits

  • ✅ Reduced network requests by eliminating redundant GraphQL queries
  • ✅ Eliminated waterfall requests through parameter passing
  • ✅ Improved modal transition performance with deferred loading
  • ✅ Better user experience with immediate loading feedback

Testing

  1. Open the folder list
  2. Click on a folder name to open the Folder Explorer modal
  3. Verify the modal opens smoothly without multiple sequential requests
  4. Check that loading states are displayed appropriately
  5. Verify file upload functionality still works correctly

@github-actions github-actions bot added the size:L 100~500 LoC label Nov 17, 2025
Copy link
Member Author

yomybaby commented Nov 17, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Coverage report for ./packages/backend.ai-ui

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

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Coverage report for ./react

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

@yomybaby yomybaby force-pushed the feat/FR-1685-optimize-folder-explorer-network-requests branch from 7137ab8 to fad679b Compare November 17, 2025 13:03
@yomybaby yomybaby marked this pull request as ready for review November 17, 2025 13:04
Copilot AI review requested due to automatic review settings November 17, 2025 13:04
Copilot finished reviewing on behalf of yomybaby November 17, 2025 13:06
Copy link
Contributor

Copilot AI left a 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 useFileUploadManager instead of fetching separately
  • Implements useDeferredValue with conditional fetch policy to prevent unnecessary network requests during React transitions
  • Adds spinnerLoading prop 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

@yomybaby yomybaby marked this pull request as draft November 17, 2025 13:11
@yomybaby yomybaby force-pushed the feat/FR-1685-optimize-folder-explorer-network-requests branch from fad679b to 8ebf1de Compare November 17, 2025 13:27
@yomybaby yomybaby requested a review from Copilot November 17, 2025 13:28
@yomybaby yomybaby marked this pull request as ready for review November 17, 2025 13:28
Copilot finished reviewing on behalf of yomybaby November 17, 2025 13:29
Copy link
Contributor

Copilot AI left a 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';

…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
@yomybaby yomybaby force-pushed the feat/FR-1685-optimize-folder-explorer-network-requests branch from 8ebf1de to 845dc36 Compare November 18, 2025 08:45
@yomybaby yomybaby requested a review from agatha197 November 18, 2025 08:45
Copy link
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants