Repository navigation
[IndexBundle] Match submitted index columns to the stored ones by name - #3299
Open
codingioanniskrikos wants to merge 1 commit into
Open
codingioanniskrikos wants to merge 1 commit into
codingioanniskrikos wants to merge 1 commit into
Conversation
Since the Studio index editor sends the columns as a plain list, the form matched them to the stored columns by position. The stored columns are ordered by name, so after removing a column every column behind it was mapped onto the stored column of its predecessor. A column without interpreter that landed on an "expression" column kept that column's interpreter form and the save failed with "expression: This value should not be blank." (likewise "brickField" / "key" / "className" for getter and brick configurations). Where the leftover form had no required field, the column silently inherited the other column's configuration. A column is identified by its name: IndexColumnCollectionType now re-keys the submitted columns to the entry of the stored column with the same name before the collection is resized. New and renamed columns get an entry of their own. IndexColumnType additionally drops the getter, interpreter and column configuration form when the submitted column has none, and clears the stored value, so removing the interpreter of an existing column works too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since the Studio index editor sends the columns as a plain list, the form
matched them to the stored columns by position. The stored columns are
ordered by name, so after removing a column every column behind it was
mapped onto the stored column of its predecessor. A column without
interpreter that landed on an "expression" column kept that column's
interpreter form and the save failed with "expression: This value should
not be blank." (likewise "brickField" / "key" / "className" for getter
and brick configurations). Where the leftover form had no required field,
the column silently inherited the other column's configuration.
A column is identified by its name: IndexColumnCollectionType now re-keys
the submitted columns to the entry of the stored column with the same
name before the collection is resized. New and renamed columns get an
entry of their own.
IndexColumnType additionally drops the getter, interpreter and column
configuration form when the submitted column has none, and clears the
stored value, so removing the interpreter of an existing column works too.
What changed?
IndexColumnCollectionType: before the collection is resized, the submitted columns are re-keyed to the entry of the stored column with the same name (case-insensitive). New and renamed columns get an entryof their own.
IndexColumnType/AbstractConfigurableIndexColumnElementType: when the submitted column has no getter, no interpreter or no column configuration, the corresponding sub-form is removed and the stored valueis cleared.
interpreterConfig.Why?
Follow-up to #3296. Since the Studio index editor sends the columns as a plain list, the form matched them to the stored columns by position. The stored columns are ordered by name, so after removing a column
every column behind it was mapped onto the stored column of its predecessor:
expressioncolumn kept that column's interpreter form, and the save failed withexpression: This value should not be blank.(likewisebrickField/key/classNamefor getter and brick configurations).The same error appeared when the interpreter of an existing
expressioncolumn was removed.A column is identified by its name (see #3296), so the form now matches by name as well. Renaming a column is therefore handled as remove + add.
Closes #3295