A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix use-db-item hook not working
Ammar Ahmed6a8ccf9401ef
diff --git a/apps/mobile/app/hooks/use-db-item.ts b/apps/mobile/app/hooks/use-db-item.tsindex d6e3dd94d..34610c7e1 100644--- a/apps/mobile/app/hooks/use-db-item.ts+++ b/apps/mobile/app/hooks/use-db-item.ts@@ -69,7 +69,6 @@ export const useDBItem = <T extends keyof ItemTypeKey>(useEffect(() => {const onUpdateItem = (itemId?: string) => {if (typeof itemId === "string" && itemId !== itemIdRef.current) return;-if (!isValidIdOrIndex(idOrIndex)) return;console.log("useDBItem.onUpdateItem", idOrIndex, type);@@ -95,7 +94,12 @@ export const useDBItem = <T extends keyof ItemTypeKey>(}}};- if (useSettingStore.getState().isAppLoading) {++ if (+ useSettingStore.getState().isAppLoading &&+ //@ts-ignore+ !globalThis["IS_SHARE_EXTENSION"]+ ) {useSettingStore.subscribe((state) => {if (!state.isAppLoading) {onUpdateItem();@@ -125,14 +129,34 @@ export const useNoteLocked = (noteId: string | undefined) => {useEffect(() => {if (!noteId) return;- db.vaults- .itemExists({- type: "note",- id: noteId- })- .then((exists) => {- setLocked(exists);++ if (+ useSettingStore.getState().isAppLoading &&+ //@ts-ignore+ !globalThis["IS_SHARE_EXTENSION"]+ ) {+ useSettingStore.subscribe((state) => {+ if (!state.isAppLoading) {+ db.vaults+ .itemExists({+ type: "note",+ id: noteId+ })+ .then((exists) => {+ setLocked(exists);+ });+ }});+ } else {+ db.vaults+ .itemExists({+ type: "note",+ id: noteId+ })+ .then((exists) => {+ setLocked(exists);+ });+ }const sub = eSubscribeEvent(eDBItemUpdate, (id: string) => {if (id === noteId) {