Skip to content

Commit

Permalink
web: saving timeout notice shown every time
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed May 10, 2024
1 parent 4a616a3 commit fde45fb
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions apps/web/src/components/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 support@streetwriters.co.",
[
{
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 support@streetwriters.co."
)
),
30 * 1000
)
)
]);
]).catch((e) => {
const { hide } = showToast(
"error",
(e as Error).message,
[
{
text: "Dismiss",
onClick: () => hide()
}
],
0
);
});
}
const deferredSave = debounceWithId(saveContent, 100);

Expand Down

0 comments on commit fde45fb

Please sign in to comment.