We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9d631f commit a7df734Copy full SHA for a7df734
1 file changed
plugin/server/src/utils/clean-data.ts
@@ -82,12 +82,10 @@ export function cleanData<
82
resultData[attr] = mediaFiles.id
83
}
84
85
- })
86
87
- // Remove empty arrays after all processing
88
- Object.keys(resultData).forEach((key) => {
89
- if (Array.isArray(resultData[key]) && resultData[key].length === 0) {
90
- delete resultData[key]
+ // Remove attribute if it's an empty array
+ if (Array.isArray(resultData[attr]) && resultData[attr].length === 0) {
+ delete resultData[attr]
91
92
})
93
0 commit comments