mobile: fix item counts not showing in side menu

This commit is contained in:
Ammar Ahmed
2025-03-17 12:02:16 +05:00
committed by Abdullah Atta
parent 8246ef5146
commit bae48d3d8c
3 changed files with 19 additions and 10 deletions

View File

@@ -36,6 +36,7 @@ import { DefaultAppStyles } from "../../utils/styles";
import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph";
import { useMonographStore } from "../../stores/use-monograph-store";
import { useReminderStore } from "../../stores/use-reminder-store";
function _MenuItem({
item,
@@ -86,11 +87,11 @@ function _MenuItem({
);
break;
case "Reminders":
unsub = useFavoriteStore.subscribe((state) => {
unsub = useReminderStore.subscribe((state) => {
setItemCount(state.items?.placeholders.length || 0);
});
setItemCount(
useFavoriteStore.getState().items?.placeholders?.length || 0
useReminderStore.getState().items?.placeholders?.length || 0
);
break;
case "Monographs":

View File

@@ -82,7 +82,7 @@ import Notifications from "../services/notifications";
import PremiumService from "../services/premium";
import SettingsService from "../services/settings";
import Sync from "../services/sync";
import { clearAllStores, initAfterSync } from "../stores";
import { clearAllStores, initAfterSync, initialize } from "../stores";
import { refreshAllStores } from "../stores/create-db-collection-store";
import { useAttachmentStore } from "../stores/use-attachment-store";
import { useMessageStore } from "../stores/use-message-store";
@@ -393,6 +393,7 @@ const initializeDatabase = async (password?: string) => {
try {
await setupDatabase(password);
await db.init();
initialize();
Sync.run();
} catch (e) {
DatabaseLogger.error(e as Error);

View File

@@ -36,20 +36,27 @@ export function initAfterSync() {
Navigation.queueRoutesForUpdate();
// Whenever sync completes, try to reschedule
// any new/updated reminders.
useUserStore.setState({
profile: db.settings.getProfile()
});
initialize();
NotePreviewWidget.updateNotes();
}
export async function initialize() {
Notifications.setupReminders(true);
useRelationStore.getState().update();
useMenuStore.getState().setColorNotes();
useMenuStore.getState().setMenuPins();
useMonographStore.getState().refresh();
useUserStore.setState({
profile: db.settings.getProfile()
});
NotePreviewWidget.updateNotes();
useTrashStore.getState().refresh();
useNotebookStore.getState().refresh();
useNoteStore.getState().refresh();
useTagStore.getState().refresh();
useFavoriteStore.getState().refresh();
useReminderStore.getState().refresh();
}
export async function initialize() {}
export function clearAllStores() {
useNotebookStore.getState().clear();
useTagStore.getState().clear();