mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Don’t fetch project metadata until we have the token
This commit is contained in:
parent
8b4c692e33
commit
9eb1b44098
1 changed files with 5 additions and 2 deletions
|
@ -142,13 +142,16 @@ class Preview extends React.Component {
|
||||||
this.props.sessionStatus === sessionActions.Status.FETCHED) ||
|
this.props.sessionStatus === sessionActions.Status.FETCHED) ||
|
||||||
(this.state.projectId !== prevState.projectId))) {
|
(this.state.projectId !== prevState.projectId))) {
|
||||||
this.fetchCommunityData();
|
this.fetchCommunityData();
|
||||||
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
|
|
||||||
if (this.state.justShared) {
|
if (this.state.justShared) {
|
||||||
this.setState({ // eslint-disable-line react/no-did-update-set-state
|
this.setState({ // eslint-disable-line react/no-did-update-set-state
|
||||||
justShared: false
|
justShared: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
|
||||||
|
storage.setProjectToken(this.props.projectInfo.project_token);
|
||||||
|
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
|
||||||
|
}
|
||||||
if (this.state.projectId === '0' && this.state.projectId !== prevState.projectId) {
|
if (this.state.projectId === '0' && this.state.projectId !== prevState.projectId) {
|
||||||
this.props.resetProject();
|
this.props.resetProject();
|
||||||
if (this.state.justRemixed || this.state.justShared) {
|
if (this.state.justRemixed || this.state.justShared) {
|
||||||
|
@ -159,7 +162,6 @@ class Preview extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
|
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
|
||||||
storage.setProjectToken(this.props.projectInfo.project_token);
|
|
||||||
if (typeof this.props.projectInfo.id === 'undefined') {
|
if (typeof this.props.projectInfo.id === 'undefined') {
|
||||||
this.initCounts(0, 0);
|
this.initCounts(0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -197,6 +199,7 @@ class Preview extends React.Component {
|
||||||
|
|
||||||
// Switching out of editor mode, refresh data that comes from project json
|
// Switching out of editor mode, refresh data that comes from project json
|
||||||
if (this.props.playerMode && !prevProps.playerMode) {
|
if (this.props.playerMode && !prevProps.playerMode) {
|
||||||
|
storage.setProjectToken(this.props.projectInfo.project_token);
|
||||||
this.getProjectData(
|
this.getProjectData(
|
||||||
this.state.projectId,
|
this.state.projectId,
|
||||||
false // Do not show cloud/username alerts again
|
false // Do not show cloud/username alerts again
|
||||||
|
|
Loading…
Reference in a new issue