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:
被雨水过滤的空气-Rairn 2023-06-26 15:27:56 +08:00 committed by GitHub
parent f042a2307a
commit 88d4af14df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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 (

View File

@ -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']}`);