@@ -17,17 +17,15 @@ import * as liveMessage from './liveMessageOperators';
1717
1818export const internal = internalActions ;
1919
20- export const signInToRoom : AsyncAction < {
21- roomId : string ;
22- } > = withLoadApp ( async ( { state, effects, actions } , { roomId } ) => {
23- await actions . internal . signIn ( { } ) ;
24-
25- if ( state . isLoggedIn ) {
26- await actions . live . roomJoined ( {
27- roomId,
28- } ) ;
20+ export const signInToRoom : AsyncAction < string > = withLoadApp (
21+ async ( { actions, state } , roomId ) => {
22+ await actions . internal . signIn ( { } ) ;
23+
24+ if ( state . isLoggedIn ) {
25+ await actions . live . roomJoined ( roomId ) ;
26+ }
2927 }
30- } ) ;
28+ ) ;
3129
3230export const onOperationError : Action < {
3331 moduleShortid : string ;
@@ -39,57 +37,57 @@ export const onOperationError: Action<{
3937 } ) ;
4038} ;
4139
42- export const roomJoined : AsyncAction < {
43- roomId : string ;
44- } > = withLoadApp ( async ( { state, effects, actions } , { roomId } ) => {
45- if ( ! state . isLoggedIn ) {
46- return ;
47- }
40+ export const roomJoined : AsyncAction < string > = withLoadApp (
41+ async ( { actions, effects, state } , roomId ) => {
42+ if ( ! state . isLoggedIn ) {
43+ return ;
44+ }
4845
49- await effects . vscode . initialized ;
50- await effects . vscode . closeAllTabs ( ) ;
46+ await effects . vscode . initialized ;
47+ await effects . vscode . closeAllTabs ( ) ;
5148
52- state . live . joinSource = 'live' ;
49+ state . live . joinSource = 'live' ;
5350
54- if ( state . live . isLive ) {
55- actions . live . internal . disconnect ( ) ;
56- }
51+ if ( state . live . isLive ) {
52+ actions . live . internal . disconnect ( ) ;
53+ }
5754
58- const sandbox = await actions . live . internal . initialize ( roomId ) ;
55+ const sandbox = await actions . live . internal . initialize ( roomId ) ;
5956
60- if ( ! sandbox ) {
61- return ;
62- }
57+ if ( ! sandbox ) {
58+ return ;
59+ }
6360
64- if ( state . updateStatus === 'available' ) {
65- const modal = 'liveVersionMismatch' ;
66- effects . analytics . track ( 'Open Modal' , { modal } ) ;
67- state . currentModal = modal ;
68- }
61+ if ( state . updateStatus === 'available' ) {
62+ const modal = 'liveVersionMismatch' ;
63+ effects . analytics . track ( 'Open Modal' , { modal } ) ;
64+ state . currentModal = modal ;
65+ }
6966
70- await actions . internal . setCurrentSandbox ( sandbox ) ;
67+ await actions . internal . setCurrentSandbox ( sandbox ) ;
7168
72- actions . editor . listenToSandboxChanges ( { sandboxId : sandbox . id } ) ;
73- const items = getItems ( state ) ;
74- const defaultItem = items . find ( i => i . defaultOpen ) || items [ 0 ] ;
69+ actions . editor . listenToSandboxChanges ( { sandboxId : sandbox . id } ) ;
70+ const items = getItems ( state ) ;
71+ const defaultItem = items . find ( i => i . defaultOpen ) || items [ 0 ] ;
7572
76- state . workspace . openedWorkspaceItem = defaultItem . id ;
73+ state . workspace . openedWorkspaceItem = defaultItem . id ;
7774
78- await effects . vscode . changeSandbox ( sandbox , fs => {
79- state . editor . modulesByPath = fs ;
80- } ) ;
75+ await effects . vscode . changeSandbox ( sandbox , fs => {
76+ state . editor . modulesByPath = fs ;
77+ } ) ;
8178
82- effects . vscode . openModule ( state . editor . currentModule ) ;
79+ effects . vscode . openModule ( state . editor . currentModule ) ;
8380
84- if (
85- sandbox . featureFlags . comments &&
86- hasPermission ( sandbox . authorization , 'comment' )
87- ) {
88- actions . comments . getSandboxComments ( sandbox . id ) ;
89- }
81+ if (
82+ sandbox . featureFlags . comments &&
83+ hasPermission ( sandbox . authorization , 'comment' )
84+ ) {
85+ actions . comments . getSandboxComments ( sandbox . id ) ;
86+ }
9087
91- state . editor . isLoading = false ;
92- } ) ;
88+ state . editor . isLoading = false ;
89+ }
90+ ) ;
9391
9492export const createLiveClicked : AsyncAction < string > = async (
9593 { actions, effects, state } ,
0 commit comments