Skip to content

fix(protocol-designer): don't show errors until attempting to save/continue #18627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 16, 2025

Conversation

ncdiehl11
Copy link
Collaborator

@ncdiehl11 ncdiehl11 commented Jun 13, 2025

Overview

Fixes logic for showing form errors, especially when reopening an errored-out saved form. We previously used a state variable for whether or not to show the form errors, such that they would only show if a user tried to continue/save a form containing an error. After a large error handling refactor was merged, this state was unused, such that errors would show automatically when reopening a form.

This PR adds logic to the makeSingleEditFieldProps util to show form errors in the following scenarios:

  1. the error is due to the field being required, and the form is saved and reopened
  2. the error is of any type, the form is pre-saved or saved, and the user attempts to continue or save

I also wire up a new optional property of the form error to specify whether or not to show the error upon reopening in scenario 1 above.

Closes RQA-4280

Test Plan and Hands on Testing

  • create a protocol with a heater-shaker
  • make a heater-shaker step with at least one toggle field left un-toggled (heater, shaker field)
  • delete the heater shaker from deck hardware
  • open the errored heater shaker step and see that the module dropdown field shows an error immediately
  • toggle a field that was toggled off initially, but leave the exposed input field empty
  • click save
  • see that the input field revealed by the toggle is now erroring

Changelog

  • consider showFormErrors state variable and saved/pre-saved form state in makeSingleEditFieldProps
  • expand form-level errors to include showOnReopen property

Review requests

see test plan. the same logic for showOnReopen should extend to all fields that should show errors when reopening a saved form (think module required, pipette required, etc.)

Risk assessment

low

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 64.10256% with 14 lines in your changes missing coverage. Please review.

Project coverage is 25.90%. Comparing base (ca3a006) to head (623e673).
Report is 4 commits behind head on chore_release-pd-8.5.0.

Files with missing lines Patch % Lines
...src/pages/Designer/ProtocolSteps/StepForm/utils.ts 0.00% 10 Missing ⚠️
...esigner/ProtocolSteps/StepForm/StepFormToolbox.tsx 0.00% 3 Missing ⚠️
...er/src/steplist/formLevel/moveLabwareFormErrors.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                    Coverage Diff                     @@
##           chore_release-pd-8.5.0   #18627      +/-   ##
==========================================================
+ Coverage                   25.87%   25.90%   +0.02%     
==========================================================
  Files                        3279     3256      -23     
  Lines                      284268   281430    -2838     
  Branches                    28630    28635       +5     
==========================================================
- Hits                        73568    72911     -657     
+ Misses                     210673   208492    -2181     
  Partials                       27       27              
Flag Coverage Δ
protocol-designer 19.22% <64.10%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol-designer/src/steplist/formLevel/errors.ts 41.95% <100.00%> (+1.03%) ⬆️
...l-designer/src/steplist/formLevel/profileErrors.ts 18.33% <ø> (ø)
...er/src/steplist/formLevel/moveLabwareFormErrors.ts 4.83% <0.00%> (-0.08%) ⬇️
...esigner/ProtocolSteps/StepForm/StepFormToolbox.tsx 4.51% <0.00%> (-0.02%) ⬇️
...src/pages/Designer/ProtocolSteps/StepForm/utils.ts 22.80% <0.00%> (-0.39%) ⬇️

... and 121 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ncdiehl11 ncdiehl11 self-assigned this Jun 15, 2025
@ncdiehl11 ncdiehl11 requested a review from jerader June 15, 2025 23:47
@ncdiehl11 ncdiehl11 marked this pull request as ready for review June 15, 2025 23:47
@ncdiehl11 ncdiehl11 requested a review from a team as a code owner June 15, 2025 23:47
@ncdiehl11 ncdiehl11 removed the request for review from a team June 15, 2025 23:47
Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

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

thanks so much for this minimal code change fix to the bug! I do still want to do a larger refactor off of edge at some point for PD 8.6.

can you extend the showOnReopen boolean to 1 other area? in protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts, the getMoveLabwareFormErrors.

@ncdiehl11
Copy link
Collaborator Author

thanks so much for this minimal code change fix to the bug! I do still want to do a larger refactor off of edge at some point for PD 8.6.

can you extend the showOnReopen boolean to 1 other area? in protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts, the getMoveLabwareFormErrors.

thanks so much for this minimal code change fix to the bug! I do still want to do a larger refactor off of edge at some point for PD 8.6.

can you extend the showOnReopen boolean to 1 other area? in protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts, the getMoveLabwareFormErrors.

absolutely, good catch

@ncdiehl11 ncdiehl11 requested a review from jerader June 16, 2025 14:02
Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

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

lgtm!

@ncdiehl11 ncdiehl11 merged commit cfa7df7 into chore_release-pd-8.5.0 Jun 16, 2025
16 checks passed
@ncdiehl11 ncdiehl11 deleted the pd_fix-showing-errors branch June 16, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants