Skip to content

Commit b1327dc

Browse files
committed
Resolve conflict
1 parent 21edd4c commit b1327dc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Frontend/src/components/collab/CollaborationSpace.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,23 @@ const CollaborationSpace = () => {
104104
yText.observe(() => {
105105
setCode(yText.toString());
106106
});
107+
return () => {
108+
// clean up for room management
109+
wsProvider.destroy();
110+
doc.destroy();
111+
}
107112
};
108113

109114
const handleExit = () => {
110115
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+
}
111124
navigate("/home");
112125
};
113126

@@ -119,7 +132,10 @@ const CollaborationSpace = () => {
119132
};
120133

121134
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+
})
123139
.catch(err => console.log(err));
124140
};
125141

0 commit comments

Comments
 (0)