fix(core): unexpectedly jump to price plan when selfhosting (#10247)
This commit is contained in:
@@ -13,6 +13,7 @@ import type {
|
|||||||
WORKSPACE_DIALOG_SCHEMA,
|
WORKSPACE_DIALOG_SCHEMA,
|
||||||
} from '@affine/core/modules/dialogs/constant';
|
} from '@affine/core/modules/dialogs/constant';
|
||||||
import { GlobalContextService } from '@affine/core/modules/global-context';
|
import { GlobalContextService } from '@affine/core/modules/global-context';
|
||||||
|
import { ServerDeploymentType } from '@affine/graphql';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans } from '@affine/i18n';
|
||||||
import { ContactWithUsIcon } from '@blocksuite/icons/rc';
|
import { ContactWithUsIcon } from '@blocksuite/icons/rc';
|
||||||
import { FrameworkScope, useLiveData, useService } from '@toeverything/infra';
|
import { FrameworkScope, useLiveData, useService } from '@toeverything/infra';
|
||||||
@@ -20,6 +21,7 @@ import { debounce } from 'lodash-es';
|
|||||||
import {
|
import {
|
||||||
Suspense,
|
Suspense,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useEffect,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
@@ -72,6 +74,11 @@ const SettingModalInner = ({
|
|||||||
const loginStatus = useLiveData(
|
const loginStatus = useLiveData(
|
||||||
currentServer.scope.get(AuthService).session.status$
|
currentServer.scope.get(AuthService).session.status$
|
||||||
);
|
);
|
||||||
|
const isSelfhosted = useLiveData(
|
||||||
|
currentServer.config$.selector(
|
||||||
|
c => c.type === ServerDeploymentType.Selfhosted
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const modalContentRef = useRef<HTMLDivElement>(null);
|
const modalContentRef = useRef<HTMLDivElement>(null);
|
||||||
const modalContentWrapperRef = useRef<HTMLDivElement>(null);
|
const modalContentWrapperRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -133,6 +140,16 @@ const SettingModalInner = ({
|
|||||||
setOpenStarAFFiNEModal(true);
|
setOpenStarAFFiNEModal(true);
|
||||||
}, [setOpenStarAFFiNEModal]);
|
}, [setOpenStarAFFiNEModal]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
isSelfhosted &&
|
||||||
|
(settingState.activeTab === 'plans' ||
|
||||||
|
settingState.activeTab === 'workspace:billing')
|
||||||
|
) {
|
||||||
|
setSettingState({ activeTab: 'workspace:license' });
|
||||||
|
}
|
||||||
|
}, [isSelfhosted, settingState.activeTab]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FrameworkScope scope={currentServer.scope}>
|
<FrameworkScope scope={currentServer.scope}>
|
||||||
<SettingSidebar
|
<SettingSidebar
|
||||||
|
|||||||
Reference in New Issue
Block a user