Skip to content

Commit bc69d6e

Browse files
authored
Fix showing screenshot in the dashboard (codesandbox#2981)
1 parent 7442227 commit bc69d6e

File tree

1 file changed

+10
-8
lines changed
  • packages/app/src/app/pages/Dashboard/Content/SandboxCard

1 file changed

+10
-8
lines changed

packages/app/src/app/pages/Dashboard/Content/SandboxCard/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,15 @@ class SandboxItemComponent extends React.PureComponent<Props, State> {
121121
};
122122

123123
checkScreenshot() {
124-
if (this.props.screenshotOutdated && this.hasScreenshot()) {
125-
// We only request the screenshot if the sandbox card is in view for > 1 second
126-
this.screenshotTimeout = window.setTimeout(() => {
127-
this.requestScreenshot();
128-
}, 1000);
124+
if (this.props.screenshotOutdated) {
125+
if (this.hasScreenshot()) {
126+
// We only request the screenshot if the sandbox card is in view for > 1 second
127+
this.screenshotTimeout = window.setTimeout(() => {
128+
this.requestScreenshot();
129+
}, 1000);
130+
}
131+
} else {
132+
this.setState({ screenshotUrl: this.props.screenshotUrl });
129133
}
130134
}
131135

@@ -266,9 +270,7 @@ class SandboxItemComponent extends React.PureComponent<Props, State> {
266270
action: () => {
267271
if (this.props.collectionTeamId) {
268272
history.push(
269-
`/dashboard/teams/${this.props.collectionTeamId}/sandboxes${
270-
this.props.collectionPath
271-
}`
273+
`/dashboard/teams/${this.props.collectionTeamId}/sandboxes${this.props.collectionPath}`
272274
);
273275
} else {
274276
history.push(`/dashboard/sandboxes${this.props.collectionPath}`);

0 commit comments

Comments
 (0)