Skip to content

LIBDRUM-909. Fix race condition in validation error display after deposit#100

Merged
dsteelma-umd merged 1 commit intodrum-mainfrom
feature/LIBDRUM-909
Apr 20, 2026
Merged

LIBDRUM-909. Fix race condition in validation error display after deposit#100
dsteelma-umd merged 1 commit intodrum-mainfrom
feature/LIBDRUM-909

Conversation

@dsteelma-umd
Copy link
Copy Markdown

@dsteelma-umd dsteelma-umd commented Apr 17, 2026

When depositing with missing required fields, the backend returns errors
that trigger a form re-initialization via hasMetadataEnrichment(). This
causes checksForErrors() to be called multiple times concurrently. The
first call correctly marks form controls as touched, but initForm()
then rebuilds the controls, wiping their touched state. The second call
is skipped by the isEqual() guard in checkSectionErrors() because
this.sectionData.errorsToShow was already updated by the first call,
so markAsTouched() is never re-applied to the rebuilt controls.

This fix resets this.sectionData.errorsToShow to [] before calling
initForm() in the hasMetadataEnrichment branch of updateForm(), so the
second checksForErrors() call treats the errors as new and re-applies
them to the rebuilt form controls.

Co-authored-by: Perplexity AI noreply@perplexity.ai
https://umd-dit.atlassian.net/browse/LIBDRUM-909

@dsteelma-umd dsteelma-umd force-pushed the feature/LIBDRUM-909 branch 3 times, most recently from 313e60a to feabece Compare April 17, 2026 17:37
@dsteelma-umd dsteelma-umd changed the title LIBDRUM-909. Force re-display of validation errors on page refresh LIBDRUM-909. Fix race condition in validation error display after deposit Apr 17, 2026
@dsteelma-umd dsteelma-umd force-pushed the feature/LIBDRUM-909 branch 2 times, most recently from ded240c to 0b40afc Compare April 17, 2026 19:05
…osit

When depositing with missing required fields, the backend returns errors
that trigger a form re-initialization via hasMetadataEnrichment(). This
causes checksForErrors() to be called multiple times concurrently. The
first call correctly marks form controls as touched, but initForm()
then rebuilds the controls, wiping their touched state. The second call
is skipped by the isEqual() guard in checkSectionErrors() because
this.sectionData.errorsToShow was already updated by the first call,
so markAsTouched() is never re-applied to the rebuilt controls.

This fix resets this.sectionData.errorsToShow to [] before calling
initForm() in the hasMetadataEnrichment branch of updateForm(), so the
second checksForErrors() call treats the errors as new and re-applies
them to the rebuilt form controls.

Co-authored-by: Perplexity AI <noreply@perplexity.ai>

https://umd-dit.atlassian.net/browse/LIBDRUM-909
@dsteelma-umd dsteelma-umd merged commit 2061c95 into drum-main Apr 20, 2026
7 checks passed
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