Skip to content

Fix save button validation not reliably reflecting input state#93

Merged
BenHall-1 merged 1 commit intomasterfrom
fix-form-save
Feb 25, 2026
Merged

Fix save button validation not reliably reflecting input state#93
BenHall-1 merged 1 commit intomasterfrom
fix-form-save

Conversation

@biast12
Copy link
Copy Markdown
Contributor

@biast12 biast12 commented Feb 24, 2026

Description

Validation state from FormInputRow was not reliably reaching the parent Forms.svelte due to Svelte's $: blocks firing during component initialization before on: listeners are guaranteed to be attached.

Fixes:

  • Add onMount dispatch in FormInputRow to guarantee initial validation state is sent after mount
  • Add hasValidationErrors guard in saveInputs() to block invalid saves regardless of button UI state
  • Assign stable _key to new inputs so inputValidationErrors uses a consistent key instead of the loop index, which shifts on reorder/delete

Type of Change

  • Bug fix
  • New feature
  • Breaking change

Testing

  • Create new form
  • Add an item, fill it out
  • Add a checkbox group, leave it blank
  • Move it up above the first item
  • Fill checkbox group out properly, save button remains greyed out

Checklist

  • My code follows the style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Validation state from FormInputRow was not reliably reaching the parent Forms.svelte due to Svelte's $: blocks firing during component initialization before on: listeners are guaranteed to be attached.

Fixes:
- Add onMount dispatch in FormInputRow to guarantee initial validation state is sent after mount
- Add hasValidationErrors guard in saveInputs() to block invalid saves regardless of button UI state
- Assign stable _key to new inputs so inputValidationErrors uses a consistent key instead of the loop index, which shifts on reorder/delete
@biast12 biast12 requested a review from a team as a code owner February 24, 2026 22:48
@BenHall-1 BenHall-1 merged commit 40a8c55 into master Feb 25, 2026
1 check passed
@BenHall-1 BenHall-1 deleted the fix-form-save branch February 25, 2026 12:58
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.

3 participants