move state update before call
This commit is contained in:
parent
4aafc80b65
commit
3cbfe58ec0
|
@ -384,9 +384,9 @@ function PhotoViewer(props: Iprops) {
|
|||
const { deletedFileIds, setDeletedFileIds, items: oldItems } = props;
|
||||
try {
|
||||
deletedFileIds.add(file.id);
|
||||
await trashFiles([file]);
|
||||
setDeletedFileIds(new Set(deletedFileIds));
|
||||
updateItems(props.items.filter((item) => item.id !== file.id));
|
||||
await trashFiles([file]);
|
||||
needUpdate.current = true;
|
||||
} catch (e) {
|
||||
logError(e, 'trashFile failed');
|
||||
|
|
Loading…
Reference in a new issue