Skip to content

Commit be757e1

Browse files
fix pick sandbox issue (codesandbox#3497)
* fix pick sandbox issue * more fix * fix adding pick, not repplacing
1 parent 0fa2256 commit be757e1

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

packages/app/src/app/overmind/namespaces/explore/actions.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,18 @@ export const pickSandbox: AsyncAction<{
2323
description: string;
2424
}> = async ({ state, actions, effects }, { id, title, description }) => {
2525
try {
26-
if (!state.explore.popularSandboxes) {
27-
return;
28-
}
29-
3026
const data = await effects.api.saveSandboxPick(id, title, description);
31-
const popularSandbox = state.explore.popularSandboxes.sandboxes.find(
32-
module => module.id === id
33-
);
34-
35-
if (!popularSandbox) {
36-
effects.notificationToast.error(
37-
'Could not pick Sandbox, please refresh and try again'
38-
);
39-
return;
40-
}
27+
const popularSandbox = (
28+
state.explore.popularSandboxes?.sandboxes || []
29+
).find(module => module.id === id);
4130

42-
popularSandbox.picks = [
43-
{
31+
if (popularSandbox) {
32+
popularSandbox.picks.push({
4433
...data,
4534
// Why are we doing this?
4635
id: Math.random().toString(),
47-
},
48-
];
36+
});
37+
}
4938

5039
effects.notificationToast.success('Sandbox picked');
5140
state.currentModal = null;

standalone-packages/vscode-textmate/package-lock.json

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)