From ad59c971d6e2dbb1c77bbf51418058270541b261 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 6 Dec 2023 22:51:30 +0800 Subject: [PATCH] fix: fix route disable if disable plugin store --- client/web/src/routes/Main/Content/Personal/Sidebar.tsx | 6 +++--- client/web/src/routes/Main/Content/Personal/index.tsx | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/web/src/routes/Main/Content/Personal/Sidebar.tsx b/client/web/src/routes/Main/Content/Personal/Sidebar.tsx index c5278cb6a53..25430f7c1ab 100644 --- a/client/web/src/routes/Main/Content/Personal/Sidebar.tsx +++ b/client/web/src/routes/Main/Content/Personal/Sidebar.tsx @@ -40,9 +40,9 @@ SidebarSection.displayName = 'SidebarSection'; export const PersonalSidebar: React.FC = React.memo(() => { const converseList = useDMConverseList(); const userInfo = useUserInfo(); - const { disablePluginStore } = useGlobalConfigStore((state) => ({ - disablePluginStore: state.disablePluginStore, - })); + const disablePluginStore = useGlobalConfigStore( + (state) => state.disablePluginStore + ); const hasFriendRequest = useAppSelector( (state) => state.user.friendRequests.findIndex( diff --git a/client/web/src/routes/Main/Content/Personal/index.tsx b/client/web/src/routes/Main/Content/Personal/index.tsx index ba42ea3fd52..872e45e5ce5 100644 --- a/client/web/src/routes/Main/Content/Personal/index.tsx +++ b/client/web/src/routes/Main/Content/Personal/index.tsx @@ -9,12 +9,16 @@ import { PersonalConverse } from './Converse'; import { FriendPanel } from './Friends'; import { PluginsPanel } from './Plugins'; import { PersonalSidebar } from './Sidebar'; +import { useGlobalConfigStore } from 'tailchat-shared'; export const Personal: React.FC = React.memo(() => { const [lastVisitPanelUrl, setLastVisitPanelUrl] = useUserSessionPreference( 'personLastVisitPanelUrl' ); const location = useLocation(); + const disablePluginStore = useGlobalConfigStore( + (state) => state.disablePluginStore + ); useEffect(() => { setLastVisitPanelUrl(location.pathname); @@ -24,7 +28,9 @@ export const Personal: React.FC = React.memo(() => { }> } /> - } /> + {!disablePluginStore && ( + } /> + )} } /> {pluginCustomPanel .filter((p) => p.position === 'personal')