diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index 8c46ca64225c..425c31619a1c 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -1191,15 +1191,12 @@ export default { } } } - if (this.items.length > 0) { - if (!this.showAction || this.dataView) { - this.resource = this.items[0] - this.$emit('change-resource', this.resource) - } - } else { - if (this.dataView) { - this.$router.push({ path: '/exception/404' }) - } + if (this.items.length <= 0 && this.dataView) { + this.$router.push({ path: '/exception/404' }) + } + if (!this.showAction || this.dataView) { + this.resource = this.items?.[0] || {} + this.$emit('change-resource', this.resource) } }).catch(error => { if (!error || !error.message) {