Skip to content

Commit 38720e9

Browse files
committed
Fix race condition of live pending operation
1 parent 5ab7a64 commit 38720e9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

packages/app/src/app/overmind/effects/vscode/ModelsHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export class ModelsHandler {
103103
fileModelItem.resource.path === '/sandbox' + module.path
104104
);
105105

106-
fileModel.revert();
106+
if (fileModel) {
107+
fileModel.revert();
108+
}
107109
}
108110

109111
public changeModule = async (module: Module) => {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ export const initialize: AsyncAction<string, Sandbox | null> = async (
5959
state.live.isLoading = true;
6060

6161
try {
62-
const { roomInfo, liveUserId, sandbox } = await effects.live.joinChannel(
63-
id
64-
);
62+
const {
63+
roomInfo,
64+
liveUserId,
65+
sandbox,
66+
moduleState,
67+
} = await effects.live.joinChannel(id);
6568

6669
state.live.roomInfo = roomInfo;
6770
state.live.liveUserId = liveUserId;
@@ -74,6 +77,8 @@ export const initialize: AsyncAction<string, Sandbox | null> = async (
7477
state.editor.currentId = sandbox.id;
7578
}
7679

80+
actions.live.internal.initializeModuleState(moduleState);
81+
7782
effects.analytics.track('Live Session Joined', {});
7883
effects.live.listen(actions.live.liveMessageReceived);
7984

0 commit comments

Comments
 (0)