Skip to content

Commit dd2244e

Browse files
committed
Add more checks for unsaved code
1 parent a2bb741 commit dd2244e

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ export const setModuleSavedCode: Action<{
6969
if (moduleIndex > -1) {
7070
const module = state.editor.sandboxes[sandbox.id].modules[moduleIndex];
7171

72-
logBreadcrumb({
73-
type: 'error',
74-
message: `SETTING UNDEFINED SAVEDCODE FOR CODE: ${module.code}`,
75-
});
76-
captureException(new Error('SETTING UNDEFINED SAVEDCODE'));
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+
}
7779

7880
module.savedCode = savedCode;
7981
}
@@ -120,8 +122,18 @@ export const saveCode: AsyncAction<{
120122

121123
module.insertedAt = updatedModule.insertedAt;
122124
module.updatedAt = updatedModule.updatedAt;
123-
module.savedCode =
125+
126+
const savedCode =
124127
updatedModule.code === module.code ? null : updatedModule.code;
128+
if (savedCode === undefined) {
129+
logBreadcrumb({
130+
type: 'error',
131+
message: `SETTING UNDEFINED SAVEDCODE FOR CODE: ${updatedModule.code}`,
132+
});
133+
captureException(new Error('SETTING UNDEFINED SAVEDCODE'));
134+
}
135+
136+
module.savedCode = savedCode;
125137

126138
effects.moduleRecover.remove(sandbox.id, module);
127139

0 commit comments

Comments
 (0)