Skip to content

[NO-ISSUE] fix: edge storage resolve loading state flicker and select all functionality#3179

Open
marcusgrando wants to merge 1 commit intodevfrom
fix/edge-storage-loading-and-select-all
Open

[NO-ISSUE] fix: edge storage resolve loading state flicker and select all functionality#3179
marcusgrando wants to merge 1 commit intodevfrom
fix/edge-storage-loading-and-select-all

Conversation

@marcusgrando
Copy link
Copy Markdown
Member

Summary

This PR fixes two issues in the Edge Storage S3 interface:

  1. 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.

  2. 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:

  • When opening a bucket, the table would appear empty momentarily
  • Transitions between table and DragAndDrop were jarring
  • Users perceived the bucket as empty before data loaded

Root Cause:

  • No coordination between loading state and UI display decision
  • showDragAndDrop was only updated after API response
  • During loading, the UI didn't know what to show

Solution:

  • Added hadFilesBeforeLoading state to remember previous state
  • Created shouldShowTable computed property that uses the previous state during loading
  • Added skeleton loading UI to DragAndDrop component
  • Now the UI maintains consistency during loading transitions
Scenario Before After
Open bucket with files Table → Empty → Table with data Table with skeleton → Table with data
Open empty bucket Table → Empty → DragAndDrop DragAndDrop with skeleton → DragAndDrop
Refresh bucket with files Brief empty flash Smooth skeleton transition
Delete last file Abrupt change to DragAndDrop Smooth transition

Problem 2: Select All Not Working

Symptoms:

  • Clicking "Select All" checkbox didn't select any rows
  • Individual row selection worked, but bulk selection failed

Root Cause:

  • Selection used Array.includes() which compares by object reference
  • When data reloads, new objects are created via .map(), breaking reference equality
  • selectedItems.includes(row) always returned false for reloaded data

Solution:

  • Changed all selection comparisons to use ID-based comparison
  • includes(row)some(item => item.id === row.id)
  • Added automatic selection clearing when navigating between folders

Changes Made

src/composables/useEdgeStorage.js

  • Added isFilesLoading ref for tracking loading state
  • Added hadFilesBeforeLoading ref for remembering previous state
  • Set hadFilesBeforeLoading = true after successful upload

src/views/EdgeStorage/ListView.vue

  • Added shouldShowTable computed for smart UI switching
  • Save hadFilesBeforeLoading before starting API calls
  • Reset state when selecting a new bucket
  • Clear selection when navigating folders

src/views/EdgeStorage/components/DragAndDrop.vue

  • Added isLoading prop
  • Added skeleton loading UI with proper layout

src/templates/list-table-block/folder-list.vue

  • Changed isAllSelected to compare by ID
  • Changed toggleRowSelection to compare by ID
  • Changed stateClassRules to use .some() for consistency
  • Updated template checkbox conditions to use ID comparison

Testing Checklist

  • Open bucket with files - should show table with skeleton during load
  • Open empty bucket - should show DragAndDrop with skeleton during load
  • Refresh bucket - should maintain table/DragAndDrop without flicker
  • Click "Select All" - should select all file rows (not folders)
  • Navigate to subfolder - selection should clear
  • Delete last file - should transition smoothly to DragAndDrop
  • Upload to empty bucket - should transition smoothly to table

…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
@robsongajunior robsongajunior changed the title fix(edge-storage): resolve loading state flicker and select all functionality fix: edge storage resolve loading state flicker and select all functionality Jan 25, 2026
@robsongajunior robsongajunior changed the title fix: edge storage resolve loading state flicker and select all functionality [NO-ISSUE] fix: edge storage resolve loading state flicker and select all functionality Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants