Describe the Bug
Currently, in src/hooks/useCodeRunner.js, the function runWithJudge0 performs a standard fetch call to Judge0's public API to execute non-JS/HTML code submissions.
Unlike the local JavaScript runner (which enforces a strict 10-second execution window), the Judge0 runner has no client-side timeout limit. If the Judge0 service is down, experiences heavy latency, or gets rate-limited, the fetch request will remain pending indefinitely. Consequently, the "Run" button stays in a "Running..." state, and users are locked out of executing any code unless they refresh the page.
Affected Code
In src/hooks/useCodeRunner.js:
async function runWithJudge0(code, languageId) {
const res = await fetch(
`${JUDGE0_BASE}/submissions?base64_encoded=false&wait=true`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ source_code: code, language_id: languageId }),
}
);
...
}
Describe the Bug
Currently, in
src/hooks/useCodeRunner.js, the functionrunWithJudge0performs a standardfetchcall to Judge0's public API to execute non-JS/HTML code submissions.Unlike the local JavaScript runner (which enforces a strict 10-second execution window), the Judge0 runner has no client-side timeout limit. If the Judge0 service is down, experiences heavy latency, or gets rate-limited, the
fetchrequest will remain pending indefinitely. Consequently, the "Run" button stays in a "Running..." state, and users are locked out of executing any code unless they refresh the page.Affected Code
In src/hooks/useCodeRunner.js: