Skip to content

[DCUBESDQLR-2832][HN] Scope conditional validation to dependent fields - #764

Merged
weili-govtech merged 2 commits into
pre-release/v2from
DCUBESDQLR-2832
Oct 14, 2026
Merged

weili-govtech merged 2 commits into
pre-release/v2from
DCUBESDQLR-2832

Conversation

@nvhieu9

@nvhieu9 nvhieu9 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing apis or functionality to change)
  • Documentation (change to documentation, comments or API descriptions)
  • Tests (improvements to unit tests or E2E tests)
  • Other (technical improvements, refactoring, or changes that don't fall into the above categories)

Description of changes

  • Replace the global validation flag with per-form field requests
  • Preserve custom validators during conditional revalidation
  • Link to DCUBESDQLR-2832

Checklist

  • Changes follow the project guidelines in CONTRIBUTING.md
  • Looks good on mobile and tablet
  • Updated documentation
  • Added/updated unit tests

Comment thread src/context-providers/yup/helper.ts Outdated
@nvhieu9
nvhieu9 requested a review from weili-govtech October 12, 2026 14:44
Comment thread src/__tests__/components/frontend-engine/yup/yup-helper.spec.ts Outdated
@nvhieu9

nvhieu9 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Why
useWatch returns a new array reference every render, so watchedValues in the useEffect dep array caused revalidateConditionally to fire even when source field values were unchanged. This ran conditionalSchema (which excludes top-level rules) and cleared valid errors.

Fix
Spread ...watchedValues so React compares each primitive value instead of the array reference.

@weili-govtech
weili-govtech merged commit 3f115dd into pre-release/v2 Oct 14, 2026
1 check passed
@weili-govtech
weili-govtech deleted the DCUBESDQLR-2832 branch October 14, 2026 01:33
@weili-govtech weili-govtech added this to the v2.2.11 milestone Oct 14, 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.

2 participants