2.1 KiB
2.1 KiB
Shot Table Selection Fix
Issue
The shot table multi-selection wasn't working properly, while the asset table was working correctly.
Root Cause
The selectAllChecked computed property's setter was directly modifying the selectedShots object inline instead of calling a separate function like in AssetBrowser.
Fix Applied
Before:
const selectAllChecked = computed({
get: () => {
return filteredShots.value.length > 0 &&
filteredShots.value.every(shot => selectedShots.value[shot.id]);
},
set: (checked: boolean) => {
filteredShots.value.forEach(shot => {
selectedShots.value[shot.id] = checked;
});
}
});
After:
// Separate function for toggling all selections
const toggleSelectAll = (checked: boolean) => {
filteredShots.value.forEach(shot => {
selectedShots.value[shot.id] = checked;
});
};
// Computed property that calls the function
const selectAllChecked = computed({
get: () => {
return filteredShots.value.length > 0 &&
filteredShots.value.every(shot => selectedShots.value[shot.id]);
},
set: (checked: boolean) => {
toggleSelectAll(checked);
}
});
Why This Works
Having a separate toggleSelectAll function:
- Makes the code structure match the working AssetBrowser implementation
- Provides better separation of concerns
- Makes the logic more explicit and easier to debug
- Ensures Vue's reactivity system properly tracks the changes
Testing
Test the following scenarios to verify the fix:
- ✅ Click the "Select All" checkbox - all shots should be selected
- ✅ Click it again - all shots should be deselected
- ✅ Select some shots individually, then click "Select All" - all should be selected
- ✅ With all selected, deselect one, then click "Select All" again - all should be selected
- ✅ Verify Ctrl/Cmd+Click multi-selection still works
- ✅ Verify Shift+Click range selection still works
Related Files
frontend/src/components/shot/ShotsTableView.vue- Fixed componentfrontend/src/components/asset/AssetBrowser.vue- Reference implementation