mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Try to fetch extensions in constructor of Preview
This commit is contained in:
parent
5dfbe422d7
commit
2293eebaec
1 changed files with 4 additions and 3 deletions
|
@ -55,6 +55,7 @@ class Preview extends React.Component {
|
||||||
waiting: false
|
waiting: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
this.getExtensions(this.state.projectId);
|
||||||
this.addEventListeners();
|
this.addEventListeners();
|
||||||
}
|
}
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
|
@ -124,9 +125,9 @@ class Preview extends React.Component {
|
||||||
}
|
}
|
||||||
const extensionSet = new Set();
|
const extensionSet = new Set();
|
||||||
if (projectData[0].targets) {
|
if (projectData[0].targets) {
|
||||||
projectData[0].targets.forEach(target => target.extensions.forEach(extension => {
|
projectData[0].targets.forEach(target => target.extensions.forEach(extension => {
|
||||||
extensionSet.add(EXTENSION_INFO[extension]);
|
extensionSet.add(EXTENSION_INFO[extension]);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
extensions: Array.from(extensionSet)
|
extensions: Array.from(extensionSet)
|
||||||
|
|
Loading…
Reference in a new issue