Skip to content

Commit

Permalink
adjust thumbnail generation
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Oct 16, 2024
1 parent bc9ae11 commit 76afb16
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spx-gui/src/models/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ export class Project extends Disposable {
{ immediate: true }
)
)

// new created project has no thumbnail, do save to cloud to generate thumbnail
if (this.thumbnail === '') this.saveToCloud()
}

/** watch for all changes, auto save to local cache, or touch all game files to trigger lazy loading to ensure they are in memory */
Expand Down Expand Up @@ -592,6 +589,15 @@ export class Project extends Disposable {
}
this.startAutoSaveToCloud(localCacheKey)
this.startAutoSaveToLocalCache(localCacheKey)

this.addDisposer(watch(
// new created project has no thumbnail, do save to cloud to generate thumbnail
() => this.thumbnail === '' && this.autoSaveMode === AutoSaveMode.Cloud,
(shouldGenerateThumbnail) => {
if (shouldGenerateThumbnail) this.saveToCloud?.()
},
{ immediate: true }
))
}
}

Expand Down

0 comments on commit 76afb16

Please sign in to comment.