Skip to content

Commit d18113e

Browse files
committed
fix: update checks and default related to manual thumbnail updates
1 parent daa9fb5 commit d18113e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/scratch-gui/src/components/stage-header/stage-header.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ StageHeaderComponent.propTypes = {
207207
intl: intlShape,
208208
isFullScreen: PropTypes.bool.isRequired,
209209
isPlayerOnly: PropTypes.bool.isRequired,
210-
manuallySaveThumbnails: PropTypes.bool.isRequired,
210+
manuallySaveThumbnails: PropTypes.bool,
211211
onKeyPress: PropTypes.func.isRequired,
212212
onSetStageFull: PropTypes.func.isRequired,
213213
onSetStageLarge: PropTypes.func.isRequired,
214214
onSetStageSmall: PropTypes.func.isRequired,
215215
onSetStageUnFull: PropTypes.func.isRequired,
216-
onUpdateProjectThumbnail: PropTypes.func.isRequired,
216+
onUpdateProjectThumbnail: PropTypes.func,
217217
projectId: PropTypes.number.isRequired,
218218
showBranding: PropTypes.bool.isRequired,
219219
stageSizeMode: PropTypes.oneOf(Object.keys(STAGE_SIZE_MODES)),

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
7474

7575
if (
7676
!this.props.manuallySaveThumbnails &&
77+
this.props.onUpdateProjectThumbnail &&
7778
this.props.saveThumbnailOnLoad &&
7879
this.props.isShowingWithId &&
7980
!prevProps.isShowingWithId
@@ -268,9 +269,10 @@ const ProjectSaverHOC = function (WrappedComponent) {
268269
.then(response => {
269270
this.props.onSetProjectUnchanged();
270271
const id = response.id.toString();
271-
if ((!this.props.manuallySaveThumbnails && id && this.props.onUpdateProjectThumbnail) ||
272+
if (this.props.onUpdateProjectThumbnail && id && (
273+
!this.props.manuallySaveThumbnails ||
272274
// Always save thumbnail on project creation
273-
options?.isCreatingProject) {
275+
options?.isCreatingProject)) {
274276
storeProjectThumbnail(this.props.vm, dataURI => {
275277
this.props.onUpdateProjectThumbnail(
276278
id,
@@ -430,6 +432,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
430432
isManualUpdating: getIsManualUpdating(loadingState),
431433
loadingState: loadingState,
432434
locale: state.locales.locale,
435+
manuallySaveThumbnails: ownProps.manuallySaveThumbnails ?? false,
433436
onUpdateProjectThumbnail:
434437
ownProps.onUpdateProjectThumbnail ??
435438
storage.saveProjectThumbnail?.bind(storage),

0 commit comments

Comments
 (0)