Skip to content

Commit 10d3615

Browse files
yeion7CompuIves
authored andcommitted
Prevent crash recent sandboxes (codesandbox#2460)
* prevent crash when doesn't have recent sandboxes * Add @yeion7 as a contributor
1 parent 8e46912 commit 10d3615

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,15 @@
13381338
"contributions": [
13391339
"code"
13401340
]
1341+
},
1342+
{
1343+
"login": "yeion7",
1344+
"name": "Yeison Daza",
1345+
"avatar_url": "https://avatars0.githubusercontent.com/u/9127504?v=4",
1346+
"profile": "http://yeisondaza.com",
1347+
"contributions": [
1348+
"code"
1349+
]
13411350
}
13421351
],
13431352
"repoType": "github",

README.md

Lines changed: 23 additions & 3 deletions
Large diffs are not rendered by default.

packages/app/src/app/pages/Dashboard/Content/routes/RecentSandboxes/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ const RecentSandboxes = ({ store }) => (
2828
return <div>Error!</div>;
2929
}
3030

31+
const sandboxes = loading
32+
? []
33+
: (data && data.me && data.me.sandboxes) || [];
34+
3135
let mostUsedTemplate = null;
32-
if (!loading) {
33-
try {
34-
mostUsedTemplate = getMostUsedTemplate(data.me.sandboxes);
35-
} catch (e) {
36-
// Not critical
37-
}
36+
try {
37+
mostUsedTemplate = getMostUsedTemplate(sandboxes);
38+
} catch (e) {
39+
// Not critical
3840
}
3941

4042
// We want to hide all templates
4143
// TODO: make this a query variable for graphql and move the logic to the server
42-
const noTemplateSandboxes = (loading ? [] : data.me.sandboxes).filter(
43-
s => !s.customTemplate
44-
);
44+
const noTemplateSandboxes = sandboxes.filter(s => !s.customTemplate);
4545

4646
return (
4747
<Sandboxes

0 commit comments

Comments
 (0)