Skip to content

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

web: saving timeout notice shown every time

Abdullah Attafde45fb6de6b
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index 136703d9c..8702a65d1 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -88,23 +88,30 @@ async function saveContent(
type: "tiptap",
data: content
}),
- new Promise((resolve) =>
- setTimeout(() => {
- const { hide } = showToast(
- "error",
- "Saving this note is taking too long. Copy your changes and restart the app to prevent data loss. If the problem persists, please report it to us at [email protected].",
- [
- {
- text: "Dismiss",
- onClick: () => hide()
- }
- ],
- 0
- );
- resolve(undefined);
- }, 30 * 1000)
+ new Promise((_, reject) =>
+ setTimeout(
+ () =>
+ reject(
+ new Error(
+ "Saving this note is taking too long. Copy your changes and restart the app to prevent data loss. If the problem persists, please report it to us at [email protected]."
+ )
+ ),
+ 30 * 1000
+ )
)
- ]);
+ ]).catch((e) => {
+ const { hide } = showToast(
+ "error",
+ (e as Error).message,
+ [
+ {
+ text: "Dismiss",
+ onClick: () => hide()
+ }
+ ],
+ 0
+ );
+ });
}
const deferredSave = debounceWithId(saveContent, 100);