diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e36e0b0e..23d7c5eac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http: - [#450](https://github.com/wordplaydev/wordplay/issues/450) Tutorial typos! - [#444](https://github.com/wordplaydev/wordplay/issues/444) Fixed fullscreen background behavior. +- [#452](https://github.com/wordplaydev/wordplay/issues/452) Fixed aggressive local project persistence causing slowdown. - Removed `Toggle.svelte` background color when off. - Restored preferred spacing on `CodeView`. - Removed padding from `ConceptLinkUI` for better guide typography. @@ -18,6 +19,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http: - Only highlight definitions and uses of caret position when inside a token. - Fixed incorrect placement of caret; it was assuming pretty printing. - Removed unused font preload. +- Less aggressive local project persistence ### Maintenance diff --git a/src/db/ProjectsDatabase.ts b/src/db/ProjectsDatabase.ts index 6ab8df68d..0a35d62bc 100644 --- a/src/db/ProjectsDatabase.ts +++ b/src/db/ProjectsDatabase.ts @@ -142,7 +142,7 @@ export default class ProjectsDatabase { project.isTutorial() ? PersistenceType.Local : PersistenceType.Online, - false, + true, ); } @@ -529,10 +529,12 @@ export default class ProjectsDatabase { const userID = this.database.getUserID(); const editable = Array.from(this.projectHistories.values()); + // Only save unsaved local projects. const local = editable.filter( (history) => - history.getPersisted() === PersistenceType.Local || - history.getPersisted() === PersistenceType.Online, + history.isUnsaved() && + (history.getPersisted() === PersistenceType.Local || + history.getPersisted() === PersistenceType.Online), ); const online = editable.filter( (history) => history.getPersisted() === PersistenceType.Online,