File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Frontend/src/components/collab Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -104,10 +104,23 @@ const CollaborationSpace = () => {
104
104
yText . observe ( ( ) => {
105
105
setCode ( yText . toString ( ) ) ;
106
106
} ) ;
107
+ return ( ) => {
108
+ // clean up for room management
109
+ wsProvider . destroy ( ) ;
110
+ doc . destroy ( ) ;
111
+ }
107
112
} ;
108
113
109
114
const handleExit = ( ) => {
110
115
if ( websocketRef . current ) websocketRef . current . send ( JSON . stringify ( { type : 'leaveRoom' , roomId, userId } ) ) ;
116
+ // Clean up Yjs document and provider before going back to home
117
+ if ( provider ) {
118
+ provider . destroy ( ) ;
119
+ }
120
+
121
+ if ( yDoc ) {
122
+ yDoc . destroy ( ) ;
123
+ }
111
124
navigate ( "/home" ) ;
112
125
} ;
113
126
@@ -119,7 +132,10 @@ const CollaborationSpace = () => {
119
132
} ;
120
133
121
134
collabService . getCodeOutput ( code_message )
122
- . then ( result => setOutput ( result . data . run . output ) )
135
+ . then ( result => {
136
+ console . log ( result . data . run . output )
137
+ setOutput ( result . data . run . output )
138
+ } )
123
139
. catch ( err => console . log ( err ) ) ;
124
140
} ;
125
141
You can’t perform that action at this time.
0 commit comments