Skip to content

Resolve "Don't save empty measured quantities and custom fields"

Tim Eder requested to merge 245-dont-save-empty-fields into master

I implemented deletion after clicking cancel, by checking whether the quantity/custom field has just been newly created. In the case of quantities, this is done by checking if the id equals null.

It could not be done in the same way for custom fields, because they are implemented differently. Here I had to check if key is empty. Since this is a required field, an empty key should only be possible on newly created custom fields. Maybe a check in the backend could be implemented as well to prevent saving empty key fields.

After cancelling a custom field creation, the page is reloaded. However an empty field is still present, until navigating away or reloading a second time. Not sure how to fix this.

Changed implementation to Marc's suggestion in the comments.

After Saving a custom field, I call the fetch method again, to repopulate the list with the newly created field. This does not work for measured quantities because the logic is in a separate page. How can I trigger a data reload from a child page?

Closes #245 (closed)

Edited by Tim Eder

Merge request reports