Compare commits

...

1 Commits

Author SHA1 Message Date
Ammar Ahmed
977d6f9246 mobile: fix selection state causing delete to fail 2023-10-30 13:22:03 +05:00
2 changed files with 9 additions and 9 deletions

View File

@@ -43,6 +43,9 @@ const SelectionWrapper = ({
const onLongPress = () => {
if (!useSelectionStore.getState().selectionMode) {
useSelectionStore.setState({
selectedItemsList: []
});
useSelectionStore.getState().setSelectionMode(true);
}
useSelectionStore.getState().setSelectedItem(item);

View File

@@ -67,15 +67,10 @@ export const deleteItems = async (item, context) => {
});
return;
}
if (
item &&
item.id &&
useSelectionStore.getState().selectedItemsList.length === 0
) {
useSelectionStore.getState().setSelectedItem(item);
}
const { selectedItemsList } = useSelectionStore.getState();
const selectedItemsList = item
? [item]
: useSelectionStore.getState().selectedItemsList;
let notes = selectedItemsList.filter((i) => i.type === "note");
let notebooks = selectedItemsList.filter((i) => i.type === "notebook");
@@ -179,7 +174,9 @@ export const deleteItems = async (item, context) => {
});
}
Navigation.queueRoutesForUpdate();
useSelectionStore.getState().clearSelection();
if (!item) {
useSelectionStore.getState().clearSelection();
}
useMenuStore.getState().setMenuPins();
useMenuStore.getState().setColorNotes();
SearchService.updateAndSearch();