fix: 修复独立窗口打开找不到面板的bug

pull/81/head
moonrailgun 3 years ago
parent 059fcf6909
commit 0774b9a823

@ -40,7 +40,7 @@ export function useGroupMemberInfos(groupId: string): UserBaseInfo[] {
export function useGroupPanels(groupId: string): GroupPanel[] { export function useGroupPanels(groupId: string): GroupPanel[] {
const groupInfo = useGroupInfo(groupId); const groupInfo = useGroupInfo(groupId);
return useMemo(() => groupInfo?.panels ?? [], [groupId]); return useMemo(() => groupInfo?.panels ?? [], [groupInfo]);
} }
/** /**
@ -54,7 +54,7 @@ export function useGroupPanelInfo(
return useMemo( return useMemo(
() => panels.find((p) => p.id === panelId) ?? null, () => panels.find((p) => p.id === panelId) ?? null,
[groupId, panelId] [groupId, panelId, panels]
); );
} }

@ -1,5 +1,6 @@
import { GroupPluginPanel } from '@/components/Panel/group/PluginPanel'; import { GroupPluginPanel } from '@/components/Panel/group/PluginPanel';
import { TextPanel } from '@/components/Panel/group/TextPanel'; import { TextPanel } from '@/components/Panel/group/TextPanel';
import { Problem } from '@/components/Problem';
import { Alert } from 'antd'; import { Alert } from 'antd';
import React from 'react'; import React from 'react';
import { import {
@ -32,13 +33,7 @@ export const GroupPanelRender: React.FC<GroupPanelRenderProps> = React.memo(
} }
if (panelInfo === null) { if (panelInfo === null) {
return ( return <Problem text={t('面板不存在')} />;
<Alert
className="w-full text-center"
type="error"
message={t('面板不存在')}
/>
);
} }
if (panelInfo.type === GroupPanelType.TEXT) { if (panelInfo.type === GroupPanelType.TEXT) {

Loading…
Cancel
Save