Skip to content

Commit

Permalink
Fix casted value
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Dec 18, 2020
1 parent 45a76a7 commit e1dc349
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ export default {
setInitialValue() {
let value = [];
try {
value = JSON.parse(this.field.value) || [];
if (!this.field.value) {
value = [];
} else if (typeof this.field.value === 'string') {
value = JSON.parse(this.field.value) || [];
} else if (Array.isArray(this.field.value)) {
value = this.field.value;
}
} catch (e) {
value = [];
}
Expand Down

0 comments on commit e1dc349

Please sign in to comment.