chore: cache resources active tab

This commit is contained in:
jialin
2025-03-26 17:31:31 +08:00
parent bfdf02f065
commit 997e4a1edd
5 changed files with 48 additions and 3 deletions
@@ -306,7 +306,7 @@ const ModelFiles = () => {
handleDelete(
{
...record,
name: record.local_path
name: record.resolved_paths?.[0]
},
{
checkConfig: {
@@ -488,8 +488,8 @@ const ModelFiles = () => {
type="link"
btnStyle={{ width: 18, paddingInline: 2 }}
></CopyButton>
{renderParts(record)}
</span>
{renderParts(record)}
</PathWrapper>
)
);
+6 -1
View File
@@ -1,3 +1,4 @@
import useTabActive from '@/hooks/use-tab-active';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import type { TabsProps } from 'antd';
@@ -14,7 +15,10 @@ const Wrapper = styled.div`
`;
const Resources = () => {
const [activeKey, setActiveKey] = useState('workers');
const { setTabActive, getTabActive, tabsMap } = useTabActive();
const [activeKey, setActiveKey] = useState(
getTabActive(tabsMap.resources) || 'workers'
);
const intl = useIntl();
@@ -38,6 +42,7 @@ const Resources = () => {
const handleChangeTab = useCallback((key: string) => {
setActiveKey(key);
setTabActive(tabsMap.resources, key);
}, []);
return (