Skip to content

Conversation

@alexluckett
Copy link
Contributor

@alexluckett alexluckett commented Nov 28, 2025

Proposed change

Always store checkboxes as arrays in state

Prevents users changing their question from radio->checkbox and submitting without valid state. This was caused by the stateschema relying on the formschema, which supports .single() to support frontends only sending a single value.

Jira ticket: https://eaflood.atlassian.net/browse/DF-686

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Misc. (documentation, build updates, etc)

Checklist

  • You have executed this code locally and it performs as expected.
  • You have added tests to verify your code works.
  • You have added code comments and JSDoc, where appropriate.
  • There is no commented-out code.
  • You have added developer docs in README.md and docs/* (where appropriate, e.g. new features).
  • The tests are passing (npm run test).
  • The linting checks are passing (npm run lint).
  • The code has been formatted (npm run format).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

@alexluckett alexluckett requested a review from a team December 3, 2025 09:57
Copy link
Contributor

@davidjamesstone davidjamesstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good but I'm a little nervous simply because I can't remember why we didn't do this before. Or maybe we did and reverted.

We have this, where we convert null to [] for checkbox condition evaluation purposes, which can maybe be deleted with this change?

Copy link
Contributor

@jbarnsley10 jbarnsley10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm happy with this. The DeclarationField is done in a slightly different way so won't be impacted by this change.
But it does beg the question whether we should be handling all possible question type changes, and how that impacts on existing state that might be or might not be valid anymore

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.

4 participants