fix(sub-apps): fix incorrect page display when navigating sub-apps (#2126)
* fix: avoid error log * fix: fix incorrect page display when navigating sub-apps * Revert "fix: fix incorrect page display when navigating sub-apps" This reverts commit 1cfbfe2e22cb6622fdcfa1566ae8719f44fb1b39. * fix: fix incorrect page display when navigating sub-apps
This commit is contained in:
parent
f042a2307a
commit
88d4af14df
@ -1,5 +1,6 @@
|
||||
import { MenuProps } from 'antd';
|
||||
import React, { ReactNode, createContext, useCallback, useContext, useRef } from 'react';
|
||||
import _ from 'lodash';
|
||||
import React, { createContext, ReactNode, useCallback, useContext, useRef } from 'react';
|
||||
|
||||
type Item = MenuProps['items'][0] & {
|
||||
/** 在清空数组时,如果该字段为 true 则保留该选项 */
|
||||
@ -61,7 +62,7 @@ export const useMenuItem = () => {
|
||||
|
||||
shouldRerender.current = true;
|
||||
renderItems.current = () => {
|
||||
const notDeleteItems = items.filter((item) => item.notdelete);
|
||||
const notDeleteItems = items.filter((item) => item.notdelete).map((item) => _.omit(item, 'notdelete') as Item);
|
||||
items.length = 0;
|
||||
items.push(...notDeleteItems);
|
||||
return (
|
||||
|
@ -81,7 +81,7 @@ const MenuEditor = (props) => {
|
||||
onSuccess(data) {
|
||||
const schema = filterByACL(data?.data, ctx);
|
||||
// url 为 `/admin` 的情况
|
||||
if (params['*'] === 'admin') {
|
||||
if (params['*'] === 'admin' || params['*'] === 'admin/') {
|
||||
const s = findMenuItem(schema);
|
||||
if (s) {
|
||||
navigate(`/admin/${s['x-uid']}`);
|
||||
|
Loading…
Reference in New Issue
Block a user