Browse Source
filterTree assigned the filtered child array back onto the source node, so nodes that failed the predicate were dropped from the input tree permanently instead of only from the result. In frontend/mixed access mode generateRoutesByFrontend filters the module-level accessRoutes on every login and role refresh, so routes stripped for a low-privilege user stayed missing for later sessions until a full page reload. filterTree is now pure: matched nodes owning a child array are copied, nodes without children are still returned by reference.pull/8370/head
4 changed files with 148 additions and 8 deletions
@ -0,0 +1,11 @@ |
|||
--- |
|||
'@vben-core/shared': patch |
|||
--- |
|||
|
|||
fix(@vben-core/shared): keep filterTree from mutating the source tree |
|||
|
|||
`filterTree` wrote the filtered child array back onto the source node (`node[childProps] = _filterTree(node[childProps])`), so every node that failed the predicate was permanently dropped from the input tree. |
|||
|
|||
That input is a module-level constant in real apps: `generateRoutesByFrontend` filters `accessRoutes` on every login and role refresh. After a low-privilege user signed in, the routes removed for them were gone for every later session in the same page, so an admin would end up with an empty `/dashboard` submenu until a full page reload. |
|||
|
|||
`filterTree` is now pure: matched nodes that own a child array are copied, nodes without children are still returned by reference. |
|||
Loading…
Reference in new issue