mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix(core): unexpectedly jump to price plan when selfhosting (#10247)
This commit is contained in:
@@ -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<HTMLDivElement>(null);
|
||||
const modalContentWrapperRef = useRef<HTMLDivElement>(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 (
|
||||
<FrameworkScope scope={currentServer.scope}>
|
||||
<SettingSidebar
|
||||
|
||||
Reference in New Issue
Block a user