Skip to content

Commit

Permalink
fix: multiple attribute added to select
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Mar 2, 2020
1 parent 4c5512b commit bb04cd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default class Helpers {
})
}

previewData = trimObj(previewData)
previewData = trimObj(previewData, true)

previewData.className = _this.classNames(field, previewData)

Expand Down
5 changes: 4 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ window.fbEditors = {
* @param {Object} attrs {attrName: attrValue}
* @return {Object} Object trimmed of null or undefined values
*/
export const trimObj = function(attrs) {
export const trimObj = function(attrs, removeFalse = false) {
const xmlRemove = [null, undefined, '']
if (removeFalse) {
xmlRemove.push(false)
}
for (const attr in attrs) {
if (xmlRemove.includes(attrs[attr])) {
delete attrs[attr]
Expand Down

0 comments on commit bb04cd4

Please sign in to comment.