Skip to content

Commit d0014c9

Browse files
tinahirCompuIves
authored andcommitted
Fix(homepage): Second picked sandbox doesnt open in explore (codesandbox#1715)
1 parent 94012c0 commit d0014c9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/homepage/src/screens/explore/SandboxModal.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class SandboxModal extends React.PureComponent {
4343
};
4444
loadedSandboxes = {};
4545

46-
getSandbox = (sandboxId: string) => {
46+
getSandbox = sandboxId => {
4747
track('Explore Sandbox Open', { sandboxId });
4848

4949
if (this.loadedSandboxes[sandboxId]) {
@@ -71,7 +71,7 @@ export default class SandboxModal extends React.PureComponent {
7171

7272
const sandbox = await this.getSandbox(props.sandboxId);
7373

74-
this.setState({ sandbox });
74+
this.setState({ sandbox, showFrame: true });
7575

7676
if (this.frame) {
7777
await this.frameInitializedPromise;
@@ -86,10 +86,6 @@ export default class SandboxModal extends React.PureComponent {
8686
this.frameInitializedPromise = new Promise(resolve => {
8787
this.resolveFrameInitializedPromise = resolve;
8888
});
89-
90-
setTimeout(() => {
91-
this.setState({ showFrame: true });
92-
}, 1000);
9389
}
9490

9591
componentWillUnmount() {
@@ -118,7 +114,10 @@ export default class SandboxModal extends React.PureComponent {
118114

119115
componentWillReceiveProps(nextProps) {
120116
if (nextProps.sandboxId !== this.props.sandboxId) {
121-
this.setState({ sandbox: undefined });
117+
this.setState({
118+
sandbox: undefined,
119+
showFrame: false,
120+
});
122121
this.fetchSandbox(nextProps);
123122
}
124123
}

0 commit comments

Comments
 (0)