Skip to content
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

Dataset settings need multiple submits with same form input to succeed #8172

Open
MichaelBuessemeyer opened this issue Nov 6, 2024 · 0 comments

Comments

@MichaelBuessemeyer
Copy link
Contributor

MichaelBuessemeyer commented Nov 6, 2024

The frontend form validation of the dataset settings seem to be a little faulty.

Context

When I try to edit a dataset via the advanced datasource view and then try to submit the changes, I get an error that some fields have errors, although all values are valid. Only once I try to submit again, the frontend validation succeeds and then sends the data to ther server.

Expected Behavior

The first try of submitting the changes should succeed.

Current Behavior

The first try fails. I gave this a quick investigation.
The console shows an error that

validator: syncValidator(
                  (value: string) =>
                    dataLayers.filter((someLayer: APIDataLayer) => someLayer.name === value)
                      .length <= 1,
                  "Layer names must be unique.",
                ),

yields an undefined error in the first try to submit it, as the useWatch value is outdated and undefined. Switching to

validator: syncValidator(
                  (value: string) =>
                    form
                      .getFieldValue(["dataSource", "dataLayers"])
                      .filter((someLayer: APIDataLayer) => someLayer.name === value).length <= 1,
                  "Layer names must be unique.",
                ),

resolves this error, but the validation error still exists. With outOfDate: true being set in the error thrown by the validation. I did not have a quick idea regarding this, thus I created this issue.

Steps to Reproduce the bug

  1. Open the dataset settings for one ds
  2. select the advanced tab
  3. For one color layer increase the bbox by one voxel in each dim.
  4. try to save -> the error should occur
  5. try to save again -> this time it should succeed

Your Environment for bug

Nothing special. Noticed why working on #8075 but seems like this was not introduced in this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant