Skip to content

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

mobile: fix state not updated on reminder change

ammarahm-ed646dbfef6e6f
diff --git a/apps/mobile/app/components/list-items/selection-wrapper/action-strip.js b/apps/mobile/app/components/list-items/selection-wrapper/action-strip.js
index 71fde4e1f..fe147fb08 100644
--- a/apps/mobile/app/components/list-items/selection-wrapper/action-strip.js
+++ b/apps/mobile/app/components/list-items/selection-wrapper/action-strip.js
@@ -26,6 +26,7 @@ import { openVault, ToastEvent } from "../../../services/event-manager";
import Navigation from "../../../services/navigation";
import { useMenuStore } from "../../../stores/use-menu-store";
import { useNotebookStore } from "../../../stores/use-notebook-store";
+import { useRelationStore } from "../../../stores/use-relation-store";
import { useSelectionStore } from "../../../stores/use-selection-store";
import { useThemeStore } from "../../../stores/use-theme-store";
import { useTrashStore } from "../../../stores/use-trash-store";
@@ -100,7 +101,6 @@ export const ActionStrip = ({ note, setActionStrip }) => {
? "Remove Shortcut from Menu"
: "Add Shortcut to Menu",
icon: isPinnedToMenu ? "link-variant-remove" : "link-variant",
- visible: note.type !== "reminder",
onPress: async () => {
try {
if (isPinnedToMenu) {
@@ -139,7 +139,7 @@ export const ActionStrip = ({ note, setActionStrip }) => {
console.error(e);
}
},
- visible: note.type !== "note"
+ visible: note.type !== "note" && note.type !== "reminder"
},
{
title: "Copy Note",
@@ -233,6 +233,7 @@ export const ActionStrip = ({ note, setActionStrip }) => {
await db.reminders.remove(note.id);
routes.push("Reminders");
Navigation.queueRoutesForUpdate(...routes);
+ useRelationStore.getState().update();
},
positiveText: "Delete",
positiveType: "errorShade"
diff --git a/apps/mobile/app/components/selection-header/index.js b/apps/mobile/app/components/selection-header/index.js
index 789e1b51a..0dd794d3f 100644
--- a/apps/mobile/app/components/selection-header/index.js
+++ b/apps/mobile/app/components/selection-header/index.js
@@ -225,7 +225,8 @@ export const SelectionHeader = React.memo(() => {
{screen === "Trash" ||
screen === "Notebooks" ||
- screen === "Notebook" ? null : (
+ screen === "Notebook" ||
+ screen === "Reminders" ? null : (
<>
<IconButton
onPress={async () => {
diff --git a/apps/mobile/app/components/sheets/relations-list/index.tsx b/apps/mobile/app/components/sheets/relations-list/index.tsx
index 6f21beecd..f6b31b0cb 100644
--- a/apps/mobile/app/components/sheets/relations-list/index.tsx
+++ b/apps/mobile/app/components/sheets/relations-list/index.tsx
@@ -71,7 +71,7 @@ export const RelationsList = ({
button,
onAdd
}: RelationsListProps) => {
- const relations = useRelationStore();
+ const updater = useRelationStore((state) => state.updater);
const [items, setItems] = useState<Reminder[]>([]);
const colors = useThemeStore((state) => state.colors);
const hasNoRelations = !items || items.length === 0;
@@ -83,7 +83,7 @@ export const RelationsList = ({
referenceType
) as any
);
- }, [item?.id, item?.type, referenceType, relationType, relations.updater]);
+ }, [item?.id, item?.type, referenceType, relationType, updater]);
return (
<View
style={{ paddingHorizontal: 12, height: hasNoRelations ? 300 : "100%" }}
diff --git a/apps/mobile/app/hooks/use-actions.js b/apps/mobile/app/hooks/use-actions.js
index 1fb5b8a92..37df9fb96 100644
--- a/apps/mobile/app/hooks/use-actions.js
+++ b/apps/mobile/app/hooks/use-actions.js
@@ -465,6 +465,7 @@ export const useActions = ({ close = () => null, item }) => {
routes.push("Tags");
}
Navigation.queueRoutesForUpdate(...routes);
+ useRelationStore.getState().update();
},
positiveText: "Delete",
positiveType: "errorShade"