Fix CloudinaryImages multi image upload functionality. #4957
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.
Description of changes
Change lodash flatten to flattenDeep. The lodash flatten function
Flattens `array` a single level deep.
which is inadequate for more than 2 image uploads as outlined in this comment. The lodash function flattenDeepRecursively flattens a nested array.
Related issues (if any)
Cloudinary: multiple images upload not working #4857
This may or may not be fixed in PR https://github.com/keystonejs/keystone/pull/4774 which is unlikely to be merged due to its size.
Testing
npm run test-all
ran the same before and after changes we're made on Windows 10 and Ubuntu 18.04 (running in WSL).I don't foresee any browser issues associated with this.
This error is thrown during tests which I have seen elsewhere and don't believe it is affected by this PR:
Windows Chrome Version 76.0.3809.100 (Official Build) (64-bit)
npm run test-all
ran successfully.