diff --git a/packages/frontend/core/src/desktop/dialogs/setting/index.tsx b/packages/frontend/core/src/desktop/dialogs/setting/index.tsx index 67e18ce80..922d7cb35 100644 --- a/packages/frontend/core/src/desktop/dialogs/setting/index.tsx +++ b/packages/frontend/core/src/desktop/dialogs/setting/index.tsx @@ -13,6 +13,7 @@ import type { WORKSPACE_DIALOG_SCHEMA, } from '@affine/core/modules/dialogs/constant'; import { GlobalContextService } from '@affine/core/modules/global-context'; +import { ServerDeploymentType } from '@affine/graphql'; import { Trans } from '@affine/i18n'; import { ContactWithUsIcon } from '@blocksuite/icons/rc'; import { FrameworkScope, useLiveData, useService } from '@toeverything/infra'; @@ -20,6 +21,7 @@ import { debounce } from 'lodash-es'; import { Suspense, useCallback, + useEffect, useLayoutEffect, useRef, useState, @@ -72,6 +74,11 @@ const SettingModalInner = ({ const loginStatus = useLiveData( currentServer.scope.get(AuthService).session.status$ ); + const isSelfhosted = useLiveData( + currentServer.config$.selector( + c => c.type === ServerDeploymentType.Selfhosted + ) + ); const modalContentRef = useRef(null); const modalContentWrapperRef = useRef(null); @@ -133,6 +140,16 @@ const SettingModalInner = ({ setOpenStarAFFiNEModal(true); }, [setOpenStarAFFiNEModal]); + useEffect(() => { + if ( + isSelfhosted && + (settingState.activeTab === 'plans' || + settingState.activeTab === 'workspace:billing') + ) { + setSettingState({ activeTab: 'workspace:license' }); + } + }, [isSelfhosted, settingState.activeTab]); + return (