Skip to content

Commit ffa28dc

Browse files
merge master
2 parents e3d1b92 + dd2244e commit ffa28dc

File tree

4 files changed

+116
-134
lines changed

4 files changed

+116
-134
lines changed

packages/app/src/app/overmind/namespaces/editor/internalActions.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {
66
ServerContainerStatus,
77
TabType,
88
} from '@codesandbox/common/lib/types';
9+
import {
10+
captureException,
11+
logBreadcrumb,
12+
} from '@codesandbox/common/lib/utils/analytics/sentry';
913
import slugify from '@codesandbox/common/lib/utils/slugify';
1014
import {
1115
editorUrl,
@@ -63,9 +67,17 @@ export const setModuleSavedCode: Action<{
6367
);
6468

6569
if (moduleIndex > -1) {
66-
state.editor.sandboxes[sandbox.id].modules[
67-
moduleIndex
68-
].savedCode = savedCode;
70+
const module = state.editor.sandboxes[sandbox.id].modules[moduleIndex];
71+
72+
if (savedCode === undefined) {
73+
logBreadcrumb({
74+
type: 'error',
75+
message: `SETTING UNDEFINED SAVEDCODE FOR CODE: ${module.code}`,
76+
});
77+
captureException(new Error('SETTING UNDEFINED SAVEDCODE'));
78+
}
79+
80+
module.savedCode = savedCode;
6981
}
7082
};
7183

@@ -90,8 +102,18 @@ export const saveCode: AsyncAction<{
90102

91103
module.insertedAt = updatedModule.insertedAt;
92104
module.updatedAt = updatedModule.updatedAt;
93-
module.savedCode =
105+
106+
const savedCode =
94107
updatedModule.code === module.code ? null : updatedModule.code;
108+
if (savedCode === undefined) {
109+
logBreadcrumb({
110+
type: 'error',
111+
message: `SETTING UNDEFINED SAVEDCODE FOR CODE: ${updatedModule.code}`,
112+
});
113+
captureException(new Error('SETTING UNDEFINED SAVEDCODE'));
114+
}
115+
116+
module.savedCode = savedCode;
95117

96118
effects.vscode.fs.writeFile(state.editor.modulesByPath, module);
97119
effects.moduleRecover.remove(sandbox.id, module);

0 commit comments

Comments
 (0)