From 60b6b88c33f900a71bf2747e13a4ecf263517699 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 1 Oct 2022 11:36:30 +0300 Subject: [PATCH 1/2] Fix --- resources/js/components/assets/Editor/Editor.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/js/components/assets/Editor/Editor.vue b/resources/js/components/assets/Editor/Editor.vue index 99a6726b1f..29a3006b6a 100644 --- a/resources/js/components/assets/Editor/Editor.vue +++ b/resources/js/components/assets/Editor/Editor.vue @@ -294,7 +294,12 @@ export default { this.$axios.get(url).then(response => { const data = response.data.data; this.asset = data; - this.values = data.values; + + // If empty, `data.values` will be an array, but we need object for `selectFocalPoint` later on + if (!_.isEmpty(data.values)) { + this.values = data.values; + } + this.meta = data.meta; this.actionUrl = data.actionUrl; this.actions = data.actions; From e47743b79adcd871a7e82632cfb2f91635efdf52 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 3 Oct 2022 14:32:47 -0400 Subject: [PATCH 2/2] nitpick --- resources/js/components/assets/Editor/Editor.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/js/components/assets/Editor/Editor.vue b/resources/js/components/assets/Editor/Editor.vue index 29a3006b6a..81714bb9c4 100644 --- a/resources/js/components/assets/Editor/Editor.vue +++ b/resources/js/components/assets/Editor/Editor.vue @@ -295,10 +295,9 @@ export default { const data = response.data.data; this.asset = data; - // If empty, `data.values` will be an array, but we need object for `selectFocalPoint` later on - if (!_.isEmpty(data.values)) { - this.values = data.values; - } + // If there are no fields, it will be an empty array when PHP encodes + // it into JSON on the server. We'll ensure it's always an object. + this.values = _.isArray(data.values) ? {} : data.values; this.meta = data.meta; this.actionUrl = data.actionUrl;