Skip to content

Commit

Permalink
initialize the previews when adding a set to prevent a js error
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Nov 6, 2020
1 parent 402feb2 commit f9c448d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resources/js/components/fieldtypes/bard/BardFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ export default {
addSet(handle) {
const id = `set-${uniqid()}`;
const values = Object.assign({}, { type: handle }, this.meta.defaults[handle]);
let previews = {};
Object.keys(this.meta.defaults[handle]).forEach(key => previews[key] = null);
this.previews = Object.assign({}, this.previews, { [id]: previews });
this.updateSetMeta(id, this.meta.new[handle]);
// Perform this in nextTick because the meta data won't be ready until then.
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/fieldtypes/replicator/Replicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export default {
enabled: true,
});
let previews = {};
Object.keys(this.meta.defaults[handle]).forEach(key => previews[key] = null);
this.previews = Object.assign({}, this.previews, { [set._id]: previews });
this.updateSetMeta(set._id, this.meta.new[handle]);
this.values.splice(index, 0, set);
Expand Down

0 comments on commit f9c448d

Please sign in to comment.