Skip to content

Conversation

@yomybaby
Copy link
Member

@yomybaby yomybaby commented Nov 11, 2025

Resolves #4578 (FR-1645)

🐛 Problem

Users experienced incorrect selected folder counts in multiple scenarios:

  1. After partially deleting folders (moving to trash or permanent deletion)
  2. After leaving a shared folder invitation
  3. After restoring folders from trash

This led to confusion when users tried to select all items again, as the count would not match the actual selection state.

💡 Solution

This PR fixes the folder selection count mismatch by properly managing the selection state when folders are removed from the current view.

Key Changes

1. Improved Callback Naming and Semantics

  • Renamed onRequestChange prop to onRemoveRow for better semantic clarity
  • The new name clearly indicates that the callback is triggered when a row is removed from the current list

2. Fixed Selection State Management

  • Delete to Trash: Properly removes deleted folders from selection
  • Permanent Delete: Correctly updates selection when folders are permanently deleted
  • Restore from Trash: Updates selection state when folders are restored
  • Leave Shared Folder: Now correctly removes the folder from selection when user leaves a shared folder invitation

3. Enhanced Code Readability

  • Renamed currentVFolder state to deletingVFolder for clearer intent
  • Added descriptive comment for the onRemoveRow prop

4. Improved User Notifications

  • Success messages now properly display after each operation
  • Consistent notification handling across all folder operations

📝 Changes in Detail

VFolderNodes.tsx

  • Renamed callback prop from onRequestChange to onRemoveRow
  • Updated all mutation success handlers to use the new callback with correct parameters
  • Fixed SharedFolderPermissionInfoModal's onLeaveFolder to properly trigger row removal
  • Improved variable naming for better code clarity

VFolderNodeListPage.tsx

  • Updated to use the new onRemoveRow prop
  • Simplified the folder removal logic for better readability
  • Ensures selection list is properly updated when folders are removed

✅ Testing Checklist

  • Select multiple folders and delete them (move to trash) - verify count updates correctly
  • Permanently delete folders from trash - verify selection count remains accurate
  • Restore folders from trash - verify selection state updates properly
  • Select a shared folder and leave the invitation - verify the folder is removed from selection
  • Select all folders, then partially delete some - verify "Select All" works correctly afterward
  • Verify success notifications appear for all operations

🎯 Impact

This fix ensures a consistent and predictable user experience when managing folder selections, eliminating the confusion caused by mismatched selection counts after various folder operations.

@github-actions github-actions bot added the size:M 30~100 LoC label Nov 11, 2025
Copy link
Member Author


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.

@yomybaby yomybaby marked this pull request as ready for review November 11, 2025 08:03
Copilot AI review requested due to automatic review settings November 11, 2025 08:03
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements 4.61% 530/11490
🔴 Branches 3.74% 302/8081
🔴 Functions 2.88% 102/3545
🔴 Lines 4.56% 512/11234

Test suite run success

121 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from d6e3e35

Copilot finished reviewing on behalf of yomybaby November 11, 2025 08:04
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 fixes a bug where the selected folder count would become incorrect after partial deletion operations. The fix ensures that deleted, restored, or removed folders are properly removed from the selection state.

  • Renamed the callback prop from onRequestChange to onRemoveRow for clearer semantic meaning
  • Fixed selection state management by passing the folder ID to remove from the selected list
  • Improved variable naming from currentVFolder to deletingVFolder for better clarity

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
react/src/pages/VFolderNodeListPage.tsx Updated callback prop name and simplified the filter logic for removing folders from selection
react/src/components/VFolderNodes.tsx Renamed callback prop and variable, passed folder IDs to callback for proper selection state management
react/src/components/ImportNotebook.tsx Removed extraneous blank line

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yomybaby yomybaby force-pushed the fix/FR-1645-folder-selection-count branch from a957b73 to 9dead93 Compare November 11, 2025 11:03
@yomybaby yomybaby requested a review from Copilot November 11, 2025 11:08
Copilot finished reviewing on behalf of yomybaby November 11, 2025 11:10
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 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yomybaby yomybaby force-pushed the fix/FR-1645-folder-selection-count branch from 9dead93 to e4ea492 Compare November 11, 2025 11:11
@github-actions github-actions bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Nov 11, 2025
@yomybaby yomybaby requested a review from Copilot November 11, 2025 11:11
@github-actions
Copy link

github-actions bot commented Nov 11, 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 d6e3e35

Copilot finished reviewing on behalf of yomybaby November 11, 2025 11:13
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 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

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

LGTM

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

@graphite-app
Copy link

graphite-app bot commented Nov 12, 2025

Merge activity

…4613)

Resolves #4578 ([FR-1645](https://lablup.atlassian.net/browse/FR-1645))

## 🐛 Problem
Users experienced incorrect selected folder counts in multiple scenarios:
1. After partially deleting folders (moving to trash or permanent deletion)
2. After leaving a shared folder invitation
3. After restoring folders from trash

This led to confusion when users tried to select all items again, as the count would not match the actual selection state.

## 💡 Solution
This PR fixes the folder selection count mismatch by properly managing the selection state when folders are removed from the current view.

### Key Changes

#### 1. Improved Callback Naming and Semantics
- Renamed `onRequestChange` prop to `onRemoveRow` for better semantic clarity
- The new name clearly indicates that the callback is triggered when a row is removed from the current list

#### 2. Fixed Selection State Management
- **Delete to Trash**: Properly removes deleted folders from selection
- **Permanent Delete**: Correctly updates selection when folders are permanently deleted
- **Restore from Trash**: Updates selection state when folders are restored
- **Leave Shared Folder**: Now correctly removes the folder from selection when user leaves a shared folder invitation

#### 3. Enhanced Code Readability
- Renamed `currentVFolder` state to `deletingVFolder` for clearer intent
- Added descriptive comment for the `onRemoveRow` prop

#### 4. Improved User Notifications
- Success messages now properly display after each operation
- Consistent notification handling across all folder operations

## 📝 Changes in Detail

### VFolderNodes.tsx
- Renamed callback prop from `onRequestChange` to `onRemoveRow`
- Updated all mutation success handlers to use the new callback with correct parameters
- Fixed SharedFolderPermissionInfoModal's `onLeaveFolder` to properly trigger row removal
- Improved variable naming for better code clarity

### VFolderNodeListPage.tsx
- Updated to use the new `onRemoveRow` prop
- Simplified the folder removal logic for better readability
- Ensures selection list is properly updated when folders are removed

## ✅ Testing Checklist
- [ ] Select multiple folders and delete them (move to trash) - verify count updates correctly
- [ ] Permanently delete folders from trash - verify selection count remains accurate
- [ ] Restore folders from trash - verify selection state updates properly
- [ ] Select a shared folder and leave the invitation - verify the folder is removed from selection
- [ ] Select all folders, then partially delete some - verify "Select All" works correctly afterward
- [ ] Verify success notifications appear for all operations

## 🎯 Impact
This fix ensures a consistent and predictable user experience when managing folder selections, eliminating the confusion caused by mismatched selection counts after various folder operations.

[FR-1645]: https://lablup.atlassian.net/browse/FR-1645?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
@graphite-app graphite-app bot force-pushed the fix/FR-1645-folder-selection-count branch from e4ea492 to d6e3e35 Compare November 12, 2025 07:05
@graphite-app graphite-app bot merged commit d6e3e35 into main Nov 12, 2025
11 checks passed
@graphite-app graphite-app bot deleted the fix/FR-1645-folder-selection-count branch November 12, 2025 07:06
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.

Mismatch in Selected Count After Partial Folder Deletion

4 participants