Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions apps/web/src/components/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,27 @@ export async function saveContent(
ignoreEdit,
length: content.length
});
await Promise.race([
useEditorStore.getState().saveSessionContent(noteId, ignoreEdit, {

await useEditorStore
.getState()
.saveSessionContent(noteId, ignoreEdit, {
type: "tiptap",
data: content
}),
new Promise((_, reject) =>
setTimeout(
() => reject(new Error(strings.savingNoteTakingTooLong())),
30 * 1000
)
)
Comment on lines -103 to -109

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is there a reason to remove the 30s check to show the toast?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is unreliable. Maybe there's a better way to do this reliably? Feel free to suggest.

]).catch((e) => {
const { hide } = showToast(
"error",
(e as Error).message,
[
{
text: strings.dismiss(),
onClick: () => hide()
}
],
0
);
});
})

.catch((e) => {
const { hide } = showToast(
"error",
(e as Error).message,
[
{
text: strings.dismiss(),
onClick: () => hide()
}
],
0
);
});
}
const deferredSave = debounceWithId(saveContent, 100);

Expand Down
Loading