Fix file deletion logic to trigger Equatable change detection
This commit is contained in:
@@ -176,7 +176,8 @@ class FileBrowserBloc extends Bloc<FileBrowserEvent, FileBrowserState> {
|
|||||||
void _onDeleteFile(DeleteFile event, Emitter<FileBrowserState> emit) async {
|
void _onDeleteFile(DeleteFile event, Emitter<FileBrowserState> emit) async {
|
||||||
try {
|
try {
|
||||||
await _fileService.deleteFile(event.orgId, event.path);
|
await _fileService.deleteFile(event.orgId, event.path);
|
||||||
_currentFiles.removeWhere((f) => f.path == event.path);
|
// Create new list to trigger Equatable change detection
|
||||||
|
_currentFiles = _currentFiles.where((f) => f.path != event.path).toList();
|
||||||
_filteredFiles = _currentFiles
|
_filteredFiles = _currentFiles
|
||||||
.where((f) => f.name.toLowerCase().contains(_currentFilter))
|
.where((f) => f.name.toLowerCase().contains(_currentFilter))
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user