Skip to content

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

mobile: fix ts errors

Ammar Ahmedc816f8b15b7d
diff --git a/apps/mobile/app/components/note-history/preview.tsx b/apps/mobile/app/components/note-history/preview.tsx
index c61f972c3..647946eea 100644
--- a/apps/mobile/app/components/note-history/preview.tsx
+++ b/apps/mobile/app/components/note-history/preview.tsx
@@ -56,7 +56,7 @@ export default function NotePreview({
content,
note
}: {
- session: HistorySession & { session: string };
+ session?: HistorySession & { session: string };
content:
| Partial<
NoteContent<boolean> & {
@@ -81,24 +81,26 @@ export default function NotePreview({
eSendEvent(eCloseSheet);
return;
}
- await db.noteHistory.restore(session.id);
- if (useTabStore.getState().hasTabForNote(session?.noteId)) {
- const note = editorController.current.note.current[session?.noteId];
- if (note) {
- eSendEvent(eOnLoadNote, {
- item: note,
- forced: true
- });
+ if (session) {
+ await db.noteHistory.restore(session.id);
+ if (useTabStore.getState().hasTabForNote(session?.noteId)) {
+ const note = editorController.current.note.current[session?.noteId];
+ if (note) {
+ eSendEvent(eOnLoadNote, {
+ item: note,
+ forced: true
+ });
+ }
}
- }
- eSendEvent(eCloseSheet, "note_history");
- eSendEvent(eCloseSheet);
- Navigation.queueRoutesForUpdate();
+ eSendEvent(eCloseSheet, "note_history");
+ eSendEvent(eCloseSheet);
+ Navigation.queueRoutesForUpdate();
- ToastManager.show({
- heading: strings.noteRestoredFromHistory(),
- type: "success"
- });
+ ToastManager.show({
+ heading: strings.noteRestoredFromHistory(),
+ type: "success"
+ });
+ }
}
useEffect(() => {
@@ -166,7 +168,7 @@ export default function NotePreview({
currentContent?.data || "<p></p>",
content.data as string
),
- id: session?.noteId
+ id: session?.noteId || note.id
});
}
}
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index 7a8fa9c08..4cb8ebe2b 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -929,7 +929,6 @@ export const settingsGroups: SettingSection[] = [
hidden: (current) => (current as VaultStatusType)?.exists,
modifer: () => {
openVault({
- item: {},
novault: false,
title: strings.createVault()
});
@@ -943,7 +942,6 @@ export const settingsGroups: SettingSection[] = [
hidden: (current) => !(current as VaultStatusType)?.exists,
modifer: () =>
openVault({
- item: {},
changePassword: true,
novault: true,
title: strings.changeVaultPassword()
@@ -957,7 +955,6 @@ export const settingsGroups: SettingSection[] = [
hidden: (current) => !(current as VaultStatusType)?.exists,
modifer: () => {
openVault({
- item: {},
clearVault: true,
novault: true,
title: strings.clearVault() + "?"
@@ -972,7 +969,6 @@ export const settingsGroups: SettingSection[] = [
hidden: (current) => !(current as VaultStatusType)?.exists,
modifer: () => {
openVault({
- item: {},
deleteVault: true,
novault: true,
title: strings.deleteVault() + "?"
@@ -994,7 +990,6 @@ export const settingsGroups: SettingSection[] = [
modifer: (current) => {
const _current = current as VaultStatusType;
openVault({
- item: {},
fingerprintAccess: !_current.biometryEnrolled,
revokeFingerprintAccess: _current.biometryEnrolled,
novault: true,