Skip to content

Commit 0e5e0ea

Browse files
committed
Join live session on fork
1 parent f69620e commit 0e5e0ea

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
6666
// This happens when we fork. This can be avoided with state first routing
6767
if (state.editor.isForkingSandbox) {
6868
effects.vscode.openModule(state.editor.currentModule);
69+
70+
await actions.editor.internal.initializeLiveSandbox(
71+
state.editor.currentSandbox
72+
);
73+
6974
state.editor.isForkingSandbox = false;
7075
return;
7176
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,11 @@ export const onRemoveEditorClicked: Action<any> = (
194194
export const onSessionCloseClicked: Action = ({ actions, effects }) => {
195195
effects.live.sendClosed();
196196
actions.live.internal.disconnect();
197-
actions.live.internal.reset();
198197
};
199198

200199
export const onNavigateAway: Action = ({ actions, state }) => {
201200
if (state.live.isLive) {
202201
actions.live.internal.disconnect();
203-
actions.live.internal.reset();
204202
}
205203
};
206204

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export const reset: Action = ({ state, actions, effects }) => {
4747
effects.live.resetClients();
4848
};
4949

50-
export const disconnect: Action = ({ effects }) => {
51-
effects.live.resetClients();
50+
export const disconnect: Action = ({ effects, actions }) => {
5251
effects.live.disconnect();
52+
actions.live.internal.reset();
5353
};
5454

5555
export const initialize: AsyncAction<string, Sandbox> = async (

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ export const onJoin: Operator<LiveMessage<{
1717
}>> = mutate(({ effects, state }, { data }) => {
1818
state.live.liveUserId = data.live_user_id;
1919

20-
effects.notificationToast.success(
21-
state.live.isTeam ? 'Connected to Live Team!' : 'Connected to Live!'
22-
);
20+
// Show message to confirm that you've joined a live session if you're not the owner
21+
if (!state.live.isCurrentEditor) {
22+
effects.notificationToast.success('Connected to Live!');
23+
}
2324

2425
if (state.live.reconnecting) {
2526
effects.live.getAllClients().forEach(client => {

0 commit comments

Comments
 (0)