Skip to content

Clarin9/Enable periodic autosave during submission - #1488

Closed
Kasinhou wants to merge 0 commit into
dtq-dev-9-basefrom
clarin9/enable-submission-autosave
Closed

Clarin9/Enable periodic autosave during submission#1488
Kasinhou wants to merge 0 commit into
dtq-dev-9-basefrom
clarin9/enable-submission-autosave

Conversation

@Kasinhou

Copy link
Copy Markdown

Background

In v7 the submission form gave the impression of saving automatically "once in a while" while you worked through the steps. In v9 this seemed lost — you had to press Save (or happen to click from one section into another) for work to be persisted.

Analysis (on the dev instances)

The submission autosave code is identical in v7 and v9. It has two config-driven triggers, both switched off by default:

Trigger Config Default (v7 & v9)
Periodic timer submission.autosave.timer 0 → disabled
Metadata change submission.autosave.metadata [] → disabled

Verified on the live dev backends: both v7 (dev-5) and v9 (dev-6) serve submission.autosave.timer: 0. So neither deployment ran the periodic autosave.

What does work in v9 is save-on-section-change (sections.directive.ts dispatches a save when the active section changes). Confirmed live on dev-6: creating a workspace item, editing the title, then clicking into a different section fires a PATCH .../workspaceitems/{id} (HTTP 200). But if you edit fields within a single (long) section, or tab through without clicking between sections, nothing is saved until you press Save — hence the "it only saves once in a while / not like v7" impression.

Fix

Enable the built-in periodic autosave by defaulting submission.autosave.timer to 60 000 ms (1 minute). The form then saves automatically about once a minute, on top of the existing save-on-section-change. This is exactly the mechanism the timer was designed for; the periodic save dispatches the same SaveSubmissionFormAction as the section-change save that is already verified working.

  • src/config/default-app-config.tstimer: 0timer: 60 * 1000
  • config/config.example.yml — documented and set to 60000, with a note that 0 disables it

Tuning

The interval is fully configurable per deployment via submission.autosave.timer:

  • lighter cadence: 300000 (5 min, upstream's documented example)
  • disable again: 0

Happy to change the default interval if you'd prefer something other than 1 minute.

Testing

  • Existing autosave unit tests (submission.service.spec.ts) set their own timer values and are unaffected.
  • config.util.spec.ts only asserts the metadata default (unchanged).
  • The save action itself was verified end-to-end against the live v9 backend (PATCH → 200) via the section-change path, which shares the same code path as the timer.

🤖 Generated with Claude Code

@Kasinhou Kasinhou self-assigned this Aug 26, 2026
@Kasinhou Kasinhou closed this Aug 26, 2026
@Kasinhou
Kasinhou force-pushed the clarin9/enable-submission-autosave branch from ec117ec to f78da0e Compare August 26, 2026 12:24
@Kasinhou

Copy link
Copy Markdown
Author

Closed because the timer approach was wrong (per feedback).

After deeper analysis + live testing on dev-6: the v7 'save when moving to another section/step' behaviour is already present and working in v9. The relevant code (sections.directive.ts, section-container.component.html, active-section handling in submission.service.ts) is byte-identical to v7 (dtq-dev). Verified end-to-end on dev-6: type a title in one section → click into a different section → the value is saved and survives a full page reload. No timer/code change is needed to restore it.

Happy to open a fresh, targeted PR if there's a concrete gap (e.g. saving on every field blur, not only on section change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant