From 2ab718834718ab4e2e13b517bfee6dbdac113c5d Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Oct 2025 20:40:19 +0530 Subject: [PATCH] ui: clear selected resource when no items in listview Fixes #11922 Signed-off-by: Abhishek Kumar --- ui/src/views/AutogenView.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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) {