Skip to content

Commit daa9fb5

Browse files
committed
Revert "feat: ensure gui container passes onUpdateProjectThumbnail downwards"
This reverts commit c48f364.
1 parent c48f364 commit daa9fb5

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ GUIComponent.propTypes = {
489489
onTelemetryModalOptIn: PropTypes.func,
490490
onTelemetryModalOptOut: PropTypes.func,
491491
onToggleLoginOpen: PropTypes.func,
492-
onUpdateProjectThumbnail: PropTypes.func.isRequired,
492+
onUpdateProjectThumbnail: PropTypes.func,
493493
platform: PropTypes.oneOf(Object.keys(PLATFORM)),
494494
renderLogin: PropTypes.func,
495495
showComingSoon: PropTypes.bool,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ const StageHeaderComponent = function (props) {
7777
const onUpdateThumbnail = useCallback(
7878
throttle(
7979
() => {
80+
if (!onUpdateProjectThumbnail) {
81+
return;
82+
}
83+
8084
storeProjectThumbnail(vm, dataURI => {
8185
onUpdateProjectThumbnail(projectId, dataURItoBlob(dataURI));
8286
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ StageWrapperComponent.propTypes = {
6262
isRtl: PropTypes.bool.isRequired,
6363
loading: PropTypes.bool,
6464
manuallySaveThumbnails: PropTypes.bool,
65-
onUpdateProjectThumbnail: PropTypes.func.isRequired,
65+
onUpdateProjectThumbnail: PropTypes.func,
6666
stageSize: PropTypes.oneOf(Object.keys(STAGE_DISPLAY_SIZES)).isRequired,
6767
vm: PropTypes.instanceOf(VM).isRequired
6868
};

packages/scratch-gui/src/containers/gui.jsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class GUI extends React.Component {
9696
loadingStateVisible,
9797
...componentProps
9898
} = this.props;
99-
99+
100100

101101
return (
102102
<GUIComponent
@@ -127,7 +127,6 @@ GUI.propTypes = {
127127
onSeeCommunity: PropTypes.func,
128128
onStorageInit: PropTypes.func,
129129
onUpdateProjectId: PropTypes.func,
130-
onUpdateProjectThumbnail: PropTypes.func,
131130
onVmInit: PropTypes.func,
132131
platform: PropTypes.oneOf(Object.keys(PLATFORM)),
133132
setPlatform: PropTypes.func.isRequired,
@@ -152,10 +151,8 @@ GUI.defaultProps = {
152151

153152
const mapStateToProps = (state, ownProps) => {
154153
const loadingState = state.scratchGui.projectState.loadingState;
155-
const storage = state.scratchGui.config.storage;
156-
const noop = () => {};
157154
return {
158-
storage,
155+
storage: state.scratchGui.config.storage,
159156
activeTabIndex: state.scratchGui.editorTab.activeTabIndex,
160157
alertsVisible: state.scratchGui.alerts.visible,
161158
backdropLibraryVisible: state.scratchGui.modals.backdropLibrary,
@@ -172,10 +169,6 @@ const mapStateToProps = (state, ownProps) => {
172169
isRtl: state.locales.isRtl,
173170
isShowingProject: getIsShowingProject(loadingState),
174171
loadingStateVisible: state.scratchGui.modals.loadingProject,
175-
onUpdateProjectThumbnail:
176-
ownProps.onUpdateProjectThumbnail ??
177-
storage.saveProjectThumbnail?.bind(storage) ??
178-
noop,
179172
platform: ownProps.platform,
180173
projectId: state.scratchGui.projectState.projectId,
181174
soundsTabVisible: state.scratchGui.editorTab.activeTabIndex === SOUNDS_TAB_INDEX,

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
391391
onShowSaveSuccessAlert: PropTypes.func,
392392
onShowSavingAlert: PropTypes.func,
393393
onUpdateProjectData: PropTypes.func,
394-
onUpdateProjectThumbnail: PropTypes.func.isRequired,
394+
onUpdateProjectThumbnail: PropTypes.func,
395395
onUpdatedProject: PropTypes.func,
396396
noBeforeUnloadHandler: PropTypes.bool.isRequired,
397397
projectChanged: PropTypes.bool,
@@ -430,6 +430,9 @@ const ProjectSaverHOC = function (WrappedComponent) {
430430
isManualUpdating: getIsManualUpdating(loadingState),
431431
loadingState: loadingState,
432432
locale: state.locales.locale,
433+
onUpdateProjectThumbnail:
434+
ownProps.onUpdateProjectThumbnail ??
435+
storage.saveProjectThumbnail?.bind(storage),
433436
projectChanged: state.scratchGui.projectChanged,
434437
reduxProjectId: state.scratchGui.projectState.projectId,
435438
reduxProjectTitle: state.scratchGui.projectTitle,

0 commit comments

Comments
 (0)