fix: broken save on empty row existance #35216
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Peek.2023-05-08.17-07.mp4
Problem:
Unable to save the document if the first save action was initiated with an empty row. Why leave the first row empty? Cause of multi select.
Cause:
remove_empty_rows
usesget_all_docs
to fetch the child table rows.get_all_docs
loops the document and if any key(field) is an array, treats it as a table_calculate_taxes_and_totals
adds a new key_items
to the doc._items
is not an actual table, but a clone of the actualitems
field.get_all_docs
treats_items
anditems
as different table causing duplicated rows