chore: remove currentWorkspaceId & currentMetaWorkspace

This commit is contained in:
QiShaoXuan
2023-01-11 16:33:25 +08:00
parent 8e8e18fdf9
commit 926bb7fd14
19 changed files with 37 additions and 116 deletions
@@ -7,7 +7,7 @@ import usePageHelper from '@/hooks/use-page-helper';
const WorkspaceIndex = () => {
const router = useRouter();
const { currentWorkspaceId, currentWorkspace } = useAppState();
const { currentWorkspace } = useAppState();
const { createPage } = usePageHelper();
const { workspaceLoaded, activeWorkspaceId } = useEnsureWorkspace();
@@ -29,7 +29,6 @@ const WorkspaceIndex = () => {
initPage();
}, [
currentWorkspace,
currentWorkspaceId,
createPage,
router,
workspaceLoaded,
@@ -60,7 +60,7 @@ const tabMap: {
];
const WorkspaceSetting = () => {
const { currentMetaWorkSpace } = useAppState();
const { currentWorkspace } = useAppState();
const [activeTab, setActiveTab] = useState<TabNames>(tabMap[0].name);
const handleTabChange = (tab: TabNames) => {
@@ -98,7 +98,7 @@ const WorkspaceSetting = () => {
</StyledSettingSidebar>
<StyledSettingContent>
{currentMetaWorkSpace && activeTabPanelRender?.(currentMetaWorkSpace)}
{currentWorkspace && activeTabPanelRender?.(currentWorkspace)}
</StyledSettingContent>
</StyledSettingContainer>
);
+3 -3
View File
@@ -6,14 +6,14 @@ import { PageLoading } from '@/components/loading';
export const WorkspaceIndex = () => {
const router = useRouter();
const { currentWorkspaceId } = useAppState();
const { currentWorkspace } = useAppState();
const { workspaceLoaded } = useEnsureWorkspace();
useEffect(() => {
if (workspaceLoaded) {
router.push(`/workspace/${currentWorkspaceId}`);
router.push(`/workspace/${currentWorkspace?.id}`);
}
}, [currentWorkspaceId, router, workspaceLoaded]);
}, [currentWorkspace, router, workspaceLoaded]);
return <PageLoading />;
};