fix: результат редактирования не появлялся в окне «Результат появится здесь» — корень: браузер кэшировал ответ /api/jobs/:id/status со статусом «running» (не было Cache-Control), и последний финальный запрос получал stale-ответ с result=null
All checks were successful
test / test (push) Successful in 10s

This commit is contained in:
2026-08-28 01:19:17 +07:00
parent 6f611dc697
commit b4ea8df840
3 changed files with 4 additions and 2 deletions

View File

@@ -294,6 +294,6 @@
</div> </div>
</noscript> </noscript>
<script type="module" src="/js/main.js"></script> <script type="module" src="/js/main.js?v=13"></script>
</body> </body>
</html> </html>

View File

@@ -268,7 +268,7 @@ async function pollJobStatus(jobId, isEdit) {
} }
export function renderJobSuccess(data, isEdit) { export function renderJobSuccess(data, isEdit) {
const version = data.result?.version; const version = data.version || data.result?.version;
const resultImage = document.querySelector("#result-image"); const resultImage = document.querySelector("#result-image");
const resultPlaceholder = document.querySelector("#result-placeholder"); const resultPlaceholder = document.querySelector("#result-placeholder");
const resultLabel = document.querySelector("#result-label"); const resultLabel = document.querySelector("#result-label");

View File

@@ -14,6 +14,7 @@ function createJobsRoutes({ jobService }) {
router.get("/jobs", (req, res, next) => { router.get("/jobs", (req, res, next) => {
try { try {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
res.json({ ok: true, jobs: jobService.listJobs() }); res.json({ ok: true, jobs: jobService.listJobs() });
} catch (err) { } catch (err) {
next(err); next(err);
@@ -22,6 +23,7 @@ function createJobsRoutes({ jobService }) {
router.get("/jobs/:id/status", (req, res, next) => { router.get("/jobs/:id/status", (req, res, next) => {
try { try {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
const { id } = req.params; const { id } = req.params;
if (!JOB_ID_PATTERN.test(id)) { if (!JOB_ID_PATTERN.test(id)) {
throw new BadRequestError("Некорректный идентификатор задания."); throw new BadRequestError("Некорректный идентификатор задания.");