Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: throw error when renaming tag to existing tag title

Ammar Ahmede7ee455ee340
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index 4f184e1b5..74236e3b3 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -197,19 +197,22 @@ export const useActions = ({
paragraph: "Change the title of the tag " + item.title,
positivePress: async (value: string) => {
if (!value || value === "" || value.trimStart().length == 0) return;
+ try {
+ await db.tags.add({
+ id: item.id,
+ title: value
+ });
- await db.tags.add({
- id: item.id,
- title: value
- });
-
- eSendEvent(Navigation.routeNames.TaggedNotes);
- InteractionManager.runAfterInteractions(() => {
- useTagStore.getState().refresh();
- useMenuStore.getState().setMenuPins();
- Navigation.queueRoutesForUpdate();
- useRelationStore.getState().update();
- });
+ eSendEvent(Navigation.routeNames.TaggedNotes);
+ InteractionManager.runAfterInteractions(() => {
+ useTagStore.getState().refresh();
+ useMenuStore.getState().setMenuPins();
+ Navigation.queueRoutesForUpdate();
+ useRelationStore.getState().update();
+ });
+ } catch (e) {
+ ToastManager.error(e as Error, undefined, "local");
+ }
},
input: true,
defaultValue: item.title,