Skip to content

fix(DF-1004): pin form.live.version at publish to fix live submission crashes#792

Closed
mokhld wants to merge 1 commit intomainfrom
fix/our-1004-submission-version-bug
Closed

fix(DF-1004): pin form.live.version at publish to fix live submission crashes#792
mokhld wants to merge 1 commit intomainfrom
fix/our-1004-submission-version-bug

Conversation

@mokhld
Copy link
Copy Markdown
Contributor

@mokhld mokhld commented Apr 22, 2026

Summary

getFormDefinition was injecting getLatestVersion() for both Live and Draft. Draft saves bump the version, so published forms with unsaved drafts tagged live submissions with the draft's version — notify-listener then crashed on mismatched component keys.

Fix

Pin { versionNumber, createdAt } onto form.live.version at publish; read it for Live. Draft unchanged. Legacy live forms without a pin return no $$__formVersion so downstream falls back to current live definition, which is correct.

@mokhld mokhld force-pushed the fix/our-1004-submission-version-bug branch 2 times, most recently from ad44685 to 9197674 Compare April 22, 2026 17:29
… crashes

getFormDefinition was injecting the latest form-versions row regardless
of Live vs Draft state. Draft saves create new version rows, so
published forms with unsaved drafts on top had their live submissions
tagged with the draft's version number, and notify-listener crashed
trying to render the submission against a mismatched definition.

Pin { versionNumber, createdAt } onto form.live in createLiveFromDraft
and read it in getFormDefinition for Live. Draft keeps using latest.
Legacy live forms without a pinned version return the definition
unchanged; the downstream pipeline treats missing versionMetadata as
"use current live", which is the correct fallback.

Also strips any persisted $$__formVersion key from stored definitions
on the no-inject paths, guarding against stale keys from JSON re-imports.
@mokhld mokhld force-pushed the fix/our-1004-submission-version-bug branch from 9197674 to 6a351f5 Compare April 22, 2026 17:35
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 22, 2026

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