@@ -42,31 +42,15 @@ import systemPreferencesHOC from '../lib/system-preferences-hoc.jsx';
4242import GUIComponent from '../components/gui/gui.jsx' ;
4343import { setIsScratchDesktop } from '../lib/isScratchDesktop.js' ;
4444
45- const { RequestMetadata, setMetadata, unsetMetadata} = storage . scratchFetch ;
46-
47- const setProjectIdMetadata = projectId => {
48- // If project ID is '0' or zero, it's not a real project ID. In that case, remove the project ID metadata.
49- // Same if it's null undefined.
50- if ( projectId && projectId !== '0' ) {
51- setMetadata ( RequestMetadata . ProjectId , projectId ) ;
52- } else {
53- unsetMetadata ( RequestMetadata . ProjectId ) ;
54- }
55- } ;
56-
5745class GUI extends React . Component {
5846 componentDidMount ( ) {
5947 setIsScratchDesktop ( this . props . isScratchDesktop ) ;
6048 this . props . onStorageInit ( storage ) ;
6149 this . props . onVmInit ( this . props . vm ) ;
62- setProjectIdMetadata ( this . props . projectId ) ;
6350 }
6451 componentDidUpdate ( prevProps ) {
65- if ( this . props . projectId !== prevProps . projectId ) {
66- if ( this . props . projectId !== null ) {
67- this . props . onUpdateProjectId ( this . props . projectId ) ;
68- }
69- setProjectIdMetadata ( this . props . projectId ) ;
52+ if ( this . props . projectId !== prevProps . projectId && this . props . projectId !== null ) {
53+ this . props . onUpdateProjectId ( this . props . projectId ) ;
7054 }
7155 if ( this . props . isShowingProject && ! prevProps . isShowingProject ) {
7256 // this only notifies container when a project changes from not yet loaded to loaded
0 commit comments