halo-dev / halo

强大易用的开源建站工具。
https://www.halo.run
GNU General Public License v3.0
33.29k stars 9.6k forks source link

为用户设置一个为空的角色会导致角色列表报错 #6604

Closed LIlGG closed 1 week ago

LIlGG commented 1 week ago

系统信息

使用的哪种方式运行?

Docker Compose

发生了什么?

在角色列表中可以将用户设置为 ”请选择角色“,在 2.19.x 中执行此操作会导致后端 roles 返回一个 null 值,进而导致前台报错。

/kind bug /area ui /area core

复现步骤

  1. 打开用户列表
  2. 设置某个用户角色为 “请选择角色"

相关日志输出

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'metadata')
    at UserList.vue:477:32
    at renderFnWithContext (vue.global.fe3b2080.js:2399:15)
    at Object.renderSlot (vue.global.fe3b2080.js:4510:55)
    at Proxy.<anonymous> (halo-components.iife.fe3b2080.js:9:109643)
    at renderComponentRoot (vue.global.fe3b2080.js:2459:18)
    at ReactiveEffect.componentUpdateFn [as fn] (vue.global.fe3b2080.js:7505:48)
    at ReactiveEffect.run (vue.global.fe3b2080.js:539:21)
    at vue.global.fe3b2080.js:7636:18
    at setupRenderEffect (vue.global.fe3b2080.js:7646:7)
    at mountComponent (vue.global.fe3b2080.js:7414:9)

附加信息

No response

JohnNiang commented 1 week ago

/milestone 2.19.x /assign