@@ -238,16 +238,19 @@ export default function CollaborationPage(props: CollaborationProps) {
238238 }
239239 setIsLoadingTestCase ( true ) ;
240240 sendExecutingStateToMatchedUser ( true ) ;
241- const data = await ExecuteVisibleAndCustomTests ( questionDocRefId , {
242- code : code ,
243- language : selectedLanguage ,
244- customTestCases : "" ,
245- } ) ;
246- updateExecutionResults ( data ) ;
247- infoMessage ( "Test cases executed. Review the results below." ) ;
248- sendExecutionResultsToMatchedUser ( data ) ;
249- setIsLoadingTestCase ( false ) ;
250- sendExecutingStateToMatchedUser ( false ) ;
241+ try {
242+ const data = await ExecuteVisibleAndCustomTests ( questionDocRefId , {
243+ code : code ,
244+ language : selectedLanguage ,
245+ customTestCases : "" ,
246+ } ) ;
247+ updateExecutionResults ( data ) ;
248+ successMessage ( "Test cases executed. Review the results below." ) ;
249+ sendExecutionResultsToMatchedUser ( data ) ;
250+ } finally {
251+ setIsLoadingTestCase ( false ) ;
252+ sendExecutingStateToMatchedUser ( false ) ;
253+ }
251254 } ;
252255
253256 const handleSubmitCode = async ( ) => {
@@ -256,25 +259,28 @@ export default function CollaborationPage(props: CollaborationProps) {
256259 }
257260 setIsLoadingSubmission ( true ) ;
258261 sendSubmittingStateToMatchedUser ( true ) ;
259- const data = await ExecuteVisibleAndHiddenTestsAndSubmit ( questionDocRefId , {
260- code : code ,
261- language : selectedLanguage ,
262- user : currentUser ?? "" ,
263- matchedUser : matchedUser ?? "" ,
264- matchedTopics : matchedTopics ?? [ ] ,
265- title : questionTitle ?? "" ,
266- questionDifficulty : complexity ?? "" ,
267- questionTopics : categories ,
268- } ) ;
269- updateExecutionResults ( {
270- visibleTestResults : data . visibleTestResults ,
271- customTestResults : [ ] ,
272- } ) ;
273- updateSubmissionResults ( data ) ;
274- sendSubmissionResultsToMatchedUser ( data ) ;
275- successMessage ( "Code saved successfully!" ) ;
276- setIsLoadingSubmission ( false ) ;
277- sendSubmittingStateToMatchedUser ( false ) ;
262+ try {
263+ const data = await ExecuteVisibleAndHiddenTestsAndSubmit ( questionDocRefId , {
264+ code : code ,
265+ language : selectedLanguage ,
266+ user : currentUser ?? "" ,
267+ matchedUser : matchedUser ?? "" ,
268+ matchedTopics : matchedTopics ?? [ ] ,
269+ title : questionTitle ?? "" ,
270+ questionDifficulty : complexity ?? "" ,
271+ questionTopics : categories ,
272+ } ) ;
273+ updateExecutionResults ( {
274+ visibleTestResults : data . visibleTestResults ,
275+ customTestResults : [ ] ,
276+ } ) ;
277+ updateSubmissionResults ( data ) ;
278+ sendSubmissionResultsToMatchedUser ( data ) ;
279+ successMessage ( "Code saved successfully!" ) ;
280+ } finally {
281+ setIsLoadingSubmission ( false ) ;
282+ sendSubmittingStateToMatchedUser ( false ) ;
283+ }
278284 } ;
279285
280286 const handleCodeChange = ( code : string ) => {
0 commit comments