Skip to content

Commit b9c4d68

Browse files
committed
fix: 修复组件缓存失效
1 parent 147e35a commit b9c4d68

File tree

6 files changed

+3156
-913
lines changed

6 files changed

+3156
-913
lines changed

package.json

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -40,67 +40,67 @@
4040
"not ie <= 10"
4141
],
4242
"dependencies": {
43-
"@ant-design/icons": "^4.5.0",
44-
"@ant-design/pro-descriptions": "^1.9.21",
45-
"@ant-design/pro-form": "^1.43.3",
46-
"@ant-design/pro-layout": "^6.26.0",
47-
"@ant-design/pro-table": "^2.56.3",
48-
"@ant-design/pro-utils": "^1.43.2",
49-
"@umijs/route-utils": "^2.0.3",
50-
"antd": "^4.17.1",
51-
"classnames": "^2.2.6",
52-
"crypto-js": "^4.0.0",
53-
"lodash": "^4.17.11",
54-
"moment": "^2.25.3",
55-
"omit.js": "^2.0.2",
56-
"rc-util": "^5.16.0",
57-
"react": "^17.0.0",
58-
"react-activation": "^0.12.1",
59-
"react-color": "^2.19.3",
60-
"react-copy-to-clipboard": "^5.0.4",
61-
"react-cropper": "^2.1.8",
62-
"cropperjs": "^1.5.12",
63-
"react-dom": "^17.0.0",
64-
"react-helmet-async": "^1.0.4",
65-
"react-transition-group": "^4.4.2",
66-
"umi": "^v3.5.0",
67-
"umi-serve": "^1.9.10",
68-
"wangeditor": "^4.7.8"
43+
"@ant-design/icons": "~4.5.0",
44+
"@ant-design/pro-descriptions": "~1.9.21",
45+
"@ant-design/pro-form": "~1.43.3",
46+
"@ant-design/pro-layout": "~6.26.0",
47+
"@ant-design/pro-table": "~2.56.3",
48+
"@ant-design/pro-utils": "~1.43.2",
49+
"@umijs/route-utils": "~2.0.3",
50+
"antd": "~4.17.1",
51+
"classnames": "~2.2.6",
52+
"crypto-js": "~4.0.0",
53+
"lodash": "~4.17.11",
54+
"moment": "~2.25.3",
55+
"omit.js": "~2.0.2",
56+
"rc-util": "~5.16.0",
57+
"react": "~17.0.0",
58+
"react-activation": "~0.9.0",
59+
"react-color": "~2.19.3",
60+
"react-copy-to-clipboard": "~5.0.4",
61+
"react-cropper": "~2.1.8",
62+
"cropperjs": "~1.5.12",
63+
"react-dom": "~17.0.0",
64+
"react-helmet-async": "~1.0.4",
65+
"react-transition-group": "~4.4.2",
66+
"umi": "~v3.5.0",
67+
"umi-serve": "~1.9.10",
68+
"wangeditor": "~4.7.8"
6969
},
7070
"devDependencies": {
71-
"@ant-design/pro-cli": "^2.0.2",
72-
"@types/classnames": "^2.2.7",
73-
"@types/crypto-js": "^4.0.1",
74-
"@types/express": "^4.17.0",
75-
"@types/google.maps": "^3.47.1",
76-
"@types/history": "^4.7.2",
77-
"@types/jest": "^26.0.0",
78-
"@types/lodash": "^4.14.144",
79-
"@types/react": "^17.0.0",
80-
"@types/react-color": "^3.0.4",
81-
"@types/react-dom": "^17.0.0",
82-
"@types/react-helmet": "^6.1.0",
83-
"@umijs/fabric": "^2.6.2",
84-
"@umijs/plugin-blocks": "^2.0.5",
85-
"@umijs/plugin-esbuild": "^1.0.1",
86-
"@umijs/preset-ant-design-pro": "^1.2.0",
87-
"@umijs/preset-react": "^1.7.4",
88-
"@umijs/yorkie": "^2.0.3",
89-
"carlo": "^0.9.46",
90-
"cross-env": "^7.0.0",
91-
"cross-port-killer": "^1.1.1",
92-
"detect-installer": "^1.0.1",
93-
"enzyme": "^3.11.0",
94-
"eslint": "^7.32.0",
95-
"express": "^4.17.1",
96-
"gh-pages": "^3.0.0",
97-
"jsdom-global": "^3.0.2",
98-
"lint-staged": "^10.0.0",
99-
"prettier": "^2.0.1",
100-
"puppeteer-core": "^8.0.0",
101-
"stylelint": "^13.0.0",
102-
"typescript": "^4.2.2",
103-
"webpack-sources": "^3.2.3"
71+
"@ant-design/pro-cli": "~2.0.2",
72+
"@types/classnames": "~2.2.7",
73+
"@types/crypto-js": "~4.0.1",
74+
"@types/express": "~4.17.0",
75+
"@types/google.maps": "~3.47.1",
76+
"@types/history": "~4.7.2",
77+
"@types/jest": "~26.0.0",
78+
"@types/lodash": "~4.14.144",
79+
"@types/react": "~17.0.0",
80+
"@types/react-color": "~3.0.4",
81+
"@types/react-dom": "~17.0.0",
82+
"@types/react-helmet": "~6.1.0",
83+
"@umijs/fabric": "~2.6.2",
84+
"@umijs/plugin-blocks": "~2.0.5",
85+
"@umijs/plugin-esbuild": "~1.0.1",
86+
"@umijs/preset-ant-design-pro": "~1.2.0",
87+
"@umijs/preset-react": "~1.7.4",
88+
"@umijs/yorkie": "~2.0.3",
89+
"carlo": "~0.9.46",
90+
"cross-env": "~7.0.0",
91+
"cross-port-killer": "~1.1.1",
92+
"detect-installer": "~1.0.1",
93+
"enzyme": "~3.11.0",
94+
"eslint": "~7.32.0",
95+
"express": "~4.17.1",
96+
"gh-pages": "~3.0.0",
97+
"jsdom-global": "~3.0.2",
98+
"lint-staged": "~10.0.0",
99+
"prettier": "~2.0.1",
100+
"puppeteer-core": "~8.0.0",
101+
"stylelint": "~13.0.0",
102+
"typescript": "~4.2.2",
103+
"webpack-sources": "~3.2.3"
104104
},
105105
"engines": {
106106
"node": ">=10.0.0"

src/components/SettingDrawer/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.@{ant-pro-setting-drawer} {
66
&-content {
77
position: relative;
8-
//min-height: 100%;
8+
min-height: 100%;
99

1010
.ant-pro-setting-drawer-content {
1111
height: 100% !important;

src/components/SettingDrawer/index.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ import type { BodyProps, MergerSettingsType, SettingDrawerProps } from './typing
1717
import { LayoutSetting as LayoutSettingUtils } from '@/utils/Ballcat';
1818

1919
export const getFormatMessage = (): ((data: { id: string; defaultMessage?: string }) => string) => {
20-
const formatMessage = ({ id }: { id: string; defaultMessage?: string }): string => {
20+
return ({ id }: { id: string; defaultMessage?: string }): string => {
2121
const locales = getLocales();
2222
return locales[id];
2323
};
24-
return formatMessage;
2524
};
2625

2726
const Body: React.FC<BodyProps> = ({ children, prefixCls, titleKey }) => (
@@ -182,7 +181,7 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
182181
}}
183182
bodyStyle={{ paddingBottom: '0' }}
184183
drawerStyle={{ height: '100%' }}
185-
contentWrapperStyle={{ height: 'auto' }}
184+
contentWrapperStyle={{ height: 'calc(100% - 2px)' }}
186185
>
187186
<div className={`${baseClassName}-drawer-content`}>
188187
<Body titleKey="pagestyle" prefixCls={baseClassName}>
@@ -235,12 +234,6 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
235234
<LayoutSetting settings={layoutSetting} changeSetting={changeSetting} />
236235
<Divider />
237236

238-
{/*<Body titleKey="regionalsettings" prefixCls={baseClassName}>*/}
239-
{/* <RegionalSetting settings={layoutSetting} changeSetting={changeSetting}/>*/}
240-
{/*</Body>*/}
241-
242-
{/*<Divider/>*/}
243-
244237
<Body titleKey="othersettings" prefixCls={baseClassName}>
245238
<List
246239
split={false}

src/layouts/BasicLayout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
136136
siderWidth={isContentFull ? 0 : undefined}
137137
headerHeight={isContentFull ? 0 : undefined}
138138
headerRender={(headerProps, defaultDom) => (isContentFull ? undefined : defaultDom)}
139-
headerContentRender={(headerViewProps, defaultDom) => {
140-
if (initialState?.settings?.splitMenus) {
141-
return defaultDom;
142-
}
143-
139+
headerContentRender={(headerViewProps) => {
144140
return (
145141
<Header.Left
146142
headerViewProps={headerViewProps}
@@ -186,7 +182,11 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
186182
content={settings.waterMark ? initialState?.user?.info?.nickname : undefined}
187183
style={{ height: '100%' }}
188184
>
189-
<ReactKeepAlive id={keepAliveProps.id} name={keepAliveProps.name}>
185+
<ReactKeepAlive
186+
key={`keep-alive-${keepAliveProps.id}`}
187+
id={keepAliveProps.id}
188+
name={keepAliveProps.name}
189+
>
190190
{children}
191191
</ReactKeepAlive>
192192
</WaterMark>

src/pages/system/menu/SysMenuPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-
1414
import type { ActionType, ProColumns } from '@ant-design/pro-table';
1515
import { EditableProTable } from '@ant-design/pro-table';
1616
import { Button, Form as AntdForm, message, Modal, TreeSelect, Typography } from 'antd';
17-
import { FormInstance } from 'antd/es';
17+
import type { FormInstance } from 'antd/es';
1818
import { useRef, useState } from 'react';
1919

2020
const isBtn = (data: SysMenuVo | any) => {
@@ -499,7 +499,10 @@ export default () => {
499499
valueType: 'option',
500500
render: (text, recoed, _, action) => {
501501
return (
502-
<a key="editable" onClick={() => action?.startEditable?.(recoed.id)}>
502+
<a
503+
key={`editable-${recoed.id}`}
504+
onClick={() => action?.startEditable?.(recoed.id)}
505+
>
503506
编辑
504507
</a>
505508
);

0 commit comments

Comments
 (0)