[NO-ISSUE] fix: edge storage resolve loading state flicker and select all functionality#3179
Open
marcusgrando wants to merge 1 commit intodevfrom
Open
[NO-ISSUE] fix: edge storage resolve loading state flicker and select all functionality#3179marcusgrando wants to merge 1 commit intodevfrom
marcusgrando wants to merge 1 commit intodevfrom
Conversation
…ionality ## Problems Fixed ### 1. Loading State Showing Empty Table When opening the Edge Storage S3 interface, the table would briefly appear empty before showing the actual content or the DragAndDrop component. This happened because the API call takes time and there was no coordination between the loading state and the UI display decision. **Solution:** - Added `hadFilesBeforeLoading` state to remember if bucket had files before loading - Created `shouldShowTable` computed that decides what to show during loading: - If loading and bucket had files → show table with skeleton - If loading and bucket was empty → show DragAndDrop with skeleton - Added loading skeleton state to DragAndDrop component - This prevents the UI flicker between table and DragAndDrop during transitions ### 2. Select All Not Working The 'Select All' checkbox in the table header was not selecting objects. This was caused by object reference comparison failing after data reload. **Root cause:** When data is reloaded via API, new objects are created with `.map()`, causing the `includes()` comparison to fail since it compares by reference, not by value. **Solution:** - Changed all selection comparisons to use ID-based comparison instead of reference - Modified `isAllSelected` computed to compare using `selectedIds.includes(row.id)` - Modified `toggleRowSelection` to use `item.id === rowData.id` - Updated template checkbox conditions to use `.some(item => item.id === rowData.id)` - Added automatic selection clearing when navigating between folders ## Files Changed - src/composables/useEdgeStorage.js: Added isFilesLoading and hadFilesBeforeLoading states - src/views/EdgeStorage/ListView.vue: Added shouldShowTable computed, loading state management - src/views/EdgeStorage/components/DragAndDrop.vue: Added loading skeleton UI - src/templates/list-table-block/folder-list.vue: Fixed selection comparison logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two issues in the Edge Storage S3 interface:
Loading state showing empty table - The interface would briefly show an empty table before displaying content or the DragAndDrop component, causing a poor user experience.
Select All not working - The "Select All" checkbox in the table header was not selecting objects due to object reference comparison issues.
Problems & Solutions
Problem 1: Loading State Flicker
Symptoms:
Root Cause:
showDragAndDropwas only updated after API responseSolution:
hadFilesBeforeLoadingstate to remember previous stateshouldShowTablecomputed property that uses the previous state during loadingProblem 2: Select All Not Working
Symptoms:
Root Cause:
Array.includes()which compares by object reference.map(), breaking reference equalityselectedItems.includes(row)always returned false for reloaded dataSolution:
includes(row)→some(item => item.id === row.id)Changes Made
src/composables/useEdgeStorage.jsisFilesLoadingref for tracking loading statehadFilesBeforeLoadingref for remembering previous statehadFilesBeforeLoading = trueafter successful uploadsrc/views/EdgeStorage/ListView.vueshouldShowTablecomputed for smart UI switchinghadFilesBeforeLoadingbefore starting API callssrc/views/EdgeStorage/components/DragAndDrop.vueisLoadingpropsrc/templates/list-table-block/folder-list.vueisAllSelectedto compare by IDtoggleRowSelectionto compare by IDstateClassRulesto use.some()for consistencyTesting Checklist