Skip to content

fix(#679): prevent showing input errors when starting new submissions#683

Merged
latin-panda merged 6 commits intomainfrom
clear-component-state-on-form-reset
Feb 26, 2026
Merged

fix(#679): prevent showing input errors when starting new submissions#683
latin-panda merged 6 commits intomainfrom
clear-component-state-on-form-reset

Conversation

@latin-panda
Copy link
Collaborator

@latin-panda latin-panda commented Feb 25, 2026

Closes #679

I have verified this PR works in these browsers (latest versions):

  • Chrome
  • Firefox
  • Safari (macOS)
  • Safari (iOS)
  • Chrome for Android
  • Not applicable

What else has been done to verify that this works as intended?

Regression testing of geopoint in edit mode - All geopoint are placement-map
regression-geopoint.mp4
Second round of testing form errors after latest changes
no-errors-fillout-again.mp4
First round of testing
no-errors-when-restart-form.mp4

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Do we need any specific form for testing your changes? If so, please attach one.

What's changed

  • Adds a reset function to clear some properties of ODKWebForm component.

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: 010f786

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@getodk/web-forms Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

const showValidationError = ref(false);
const geolocationErrorMessage = ref<string | null>(null);

const resetComponentState = () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't include isFormEditMode from L70, it should be fine 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not convinced it's fine - if you edit a submission and hit submit you don't want the form to stay in edit mode when submitting the next form. In Central it redirects after edit, but that's not guaranteed for other users of the component, so it's safer to reset it IMO.

Copy link
Collaborator Author

@latin-panda latin-panda Feb 26, 2026

Choose a reason for hiding this comment

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

I thought about it more. The isFormEditMode depends on the state.value. I've moved it to a watch so it's always updated based on state.
I've added a video testing geopoint with maps again to ensure no regressions.
And also tested the case where the host doesnt redirect, the state is in create mode

Copy link
Collaborator

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

One suggestion, but nice fix otherwise!

const showValidationError = ref(false);
const geolocationErrorMessage = ref<string | null>(null);

const resetComponentState = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not convinced it's fine - if you edit a submission and hit submit you don't want the form to stay in edit mode when submitting the next form. In Central it redirects after edit, but that's not guaranteed for other users of the component, so it's safer to reset it IMO.

@latin-panda
Copy link
Collaborator Author

@garethbowen this is ready for another look :)

Copy link
Collaborator

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

Great work.

CI is warning about a formatting issue that would be good to fix, but approving to unblock.

@latin-panda latin-panda merged commit 12f943c into main Feb 26, 2026
54 checks passed
@latin-panda latin-panda deleted the clear-component-state-on-form-reset branch February 26, 2026 17:13
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.

Required error message in the new instance of a sent submission

2 participants