MAGETWO-81311: Check the length of the array before attempting to sli… #11637
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.
…ce it. Slicing an array of one will create an empty result. Issue: 9944
Description
#9944
In the UI form element abstract.js, there is a case where the dataScope passed to the initConfig function may not have the string "data" appended to the name. In this case, performing a 'slice' on an array of 1 will create an empty result. In these cases, I have added a check to ensure that the array is at least greater than 1 before slicing, otherwise, use the result of splitting the scope variable.
In these cases you will always end of with something like:
["data_value"] or ["data_value", "data_value_two"]
Instead of a potential: [], which when used as the inputName would result in an empty input name attribute on the form element.
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist