Skip to content

Commit bfdac36

Browse files
fixed filesystem write on save messages and loading comments joining live room
1 parent 0760ac6 commit bfdac36

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
UserViewRange,
77
} from '@codesandbox/common/lib/types';
88
import { logBreadcrumb } from '@codesandbox/common/lib/utils/analytics/sentry';
9+
import { COMMENTS } from '@codesandbox/common/lib/utils/feature-flags';
10+
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
911
import { Action, AsyncAction, Operator } from 'app/overmind';
1012
import { withLoadApp } from 'app/overmind/factories';
1113
import getItems from 'app/overmind/utils/items';
@@ -79,6 +81,11 @@ export const roomJoined: AsyncAction<{
7981
});
8082

8183
effects.vscode.openModule(state.editor.currentModule);
84+
85+
if (COMMENTS && hasPermission(sandbox.authorization, 'comment')) {
86+
actions.comments.getSandboxComments(sandbox.id);
87+
}
88+
8289
state.editor.isLoading = false;
8390
});
8491

packages/app/src/app/overmind/namespaces/live/liveMessageOperators.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const onSave: Operator<LiveMessage<{
2121
inserted_at: string;
2222
version: number;
2323
path: string;
24-
}>> = mutate(({ state }, { data }) => {
24+
}>> = mutate(({ state, effects }, { data }) => {
2525
const sandbox = state.editor.currentSandbox;
2626

2727
if (!sandbox) {
@@ -39,6 +39,7 @@ export const onSave: Operator<LiveMessage<{
3939
module.updatedAt = data.updated_at;
4040
module.insertedAt = data.inserted_at;
4141
sandbox.version = data.version;
42+
effects.vscode.sandboxFsSync.writeFile(state.editor.modulesByPath, module);
4243
});
4344

4445
export const onJoin: Operator<LiveMessage<{

0 commit comments

Comments
 (0)