From cbb1769d63dac22dbd626c91e7435fa306466791 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 10 Jun 2026 15:38:06 -0500 Subject: [PATCH] Re-render a problem in the PG problem editor after a perltidy failure. When editing a problem and the code has a syntax error that prevents perltidy from working, if perltidy is then used it shows the errors from running perltidy. If you then fix those errors and run perltidy again, the toast shows that pertidy was successful, but the errors are still shown in the render window. This pull request makes it so that when perltidy is successfully executed after a previous executing failed, then the problem is re-rendered, thus removing the perltidy errors. This is detected simply by checking if the render area contains an iframe or not. This addresses issue #3012. --- htdocs/js/PGProblemEditor/pgproblemeditor.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/js/PGProblemEditor/pgproblemeditor.js b/htdocs/js/PGProblemEditor/pgproblemeditor.js index 6f35f50b88..ede9b97c35 100644 --- a/htdocs/js/PGProblemEditor/pgproblemeditor.js +++ b/htdocs/js/PGProblemEditor/pgproblemeditor.js @@ -242,11 +242,13 @@ } if (request_object.pgCode === data.result_data.tidiedPGCode) { showMessage('There were no changes to the code.', true); + if (!(renderArea.firstChild instanceof HTMLIFrameElement)) render(); } else { if (webworkConfig?.pgCodeMirror) webworkConfig.pgCodeMirror.source = data.result_data.tidiedPGCode; else document.getElementById('problemContents').value = data.result_data.tidiedPGCode; saveTempFile(); showMessage('Successfully perltidied code.', true); + if (!(renderArea.firstChild instanceof HTMLIFrameElement)) render(); } }) .catch((err) => showMessage(`Error: ${err?.message ?? err}`));