Skip to content

Commit 9b1c860

Browse files
committed
fix: support thumbnail save on project creation
1 parent 168437b commit 9b1c860

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/scratch-gui/src/lib/project-saver-hoc.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
183183
});
184184
}
185185
createNewProjectToStorage () {
186-
return this.storeProject(null)
186+
return this.storeProject(null, {}, {isCreatingProject: true})
187187
.then(response => {
188188
this.props.onCreatedProject(response.id.toString(), this.props.loadingState);
189189
})
@@ -229,8 +229,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
229229
* @param {number|string|undefined} projectId - defined value will PUT/update; undefined/null will POST/create
230230
* @return {Promise} - resolves with json object containing project's existing or new id
231231
* @param {?object} requestParams - object of params to add to request body
232+
* @param {?object} options - additional options for the store operation
232233
*/
233-
storeProject (projectId, requestParams) {
234+
storeProject (projectId, requestParams, options) {
234235
requestParams = requestParams || {};
235236
this.clearAutoSaveTimeout();
236237
// Serialize VM state now before embarking on
@@ -267,7 +268,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
267268
.then(response => {
268269
this.props.onSetProjectUnchanged();
269270
const id = response.id.toString();
270-
if (!this.props.manuallySaveThumbnails && id && this.props.onUpdateProjectThumbnail) {
271+
if ((!this.props.manuallySaveThumbnails && id && this.props.onUpdateProjectThumbnail) ||
272+
// Always save thumbnail on project creation
273+
options?.isCreatingProject) {
271274
storeProjectThumbnail(this.props.vm, dataURI => {
272275
this.props.onUpdateProjectThumbnail(
273276
id,

0 commit comments

Comments
 (0)