drafts: Delete old drafts on page load, not modal launch.

This fixes a bad user experience where clicking to open the drafts
modal causes the number of drafts that you're looking at to suddenly
change.
This commit is contained in:
Tim Abbott 2021-07-16 12:40:28 -07:00
parent 49eab4efef
commit 8f74261d48
2 changed files with 2 additions and 3 deletions

View File

@ -201,8 +201,6 @@ test("remove_old_drafts", () => {
});
test("format_drafts", ({override, mock_template}) => {
override(drafts, "remove_old_drafts", noop);
function feb12() {
return new Date(1549958107000); // 2/12/2019 07:55:07 AM (UTC+0)
}

View File

@ -389,7 +389,6 @@ export function launch() {
});
}
remove_old_drafts();
const drafts = format_drafts(draft_model.get());
render_widgets(drafts);
@ -551,6 +550,8 @@ export function set_initial_element(drafts) {
}
export function initialize() {
remove_old_drafts();
window.addEventListener("beforeunload", () => {
update_draft();
});