Skip to content

Commit

Permalink
fix: plugin config page error
Browse files Browse the repository at this point in the history
  • Loading branch information
Baoyuantop committed Feb 10, 2023
1 parent 4d26409 commit 862b9c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions web/src/components/Plugin/PluginDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const PluginDetail: React.FC<Props> = ({

useEffect(() => {
form.setFieldsValue({
disable: isEnabled ? true : initialData[name] && !initialData[name]._meta.disable,
disable: isEnabled ? true : initialData[name] && !initialData[name]?._meta?.disable,
scope: 'global',
});
if (PLUGIN_UI_LIST.includes(name)) {
Expand Down Expand Up @@ -416,7 +416,7 @@ const PluginDetail: React.FC<Props> = ({
>
<Switch
defaultChecked={
isEnabled ? true : initialData[name] && !initialData[name]._meta.disable
isEnabled ? true : initialData[name] && !initialData[name]?._meta?.disable
}
disabled={readonly || isEnabled}
/>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/Plugin/PluginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const PluginPage: React.FC<Props> = ({

useEffect(() => {
const openPluginList = pluginList.filter(
(item) => initialData[item.name] && !initialData[item.name]._meta.disable,
(item) => initialData[item.name] && !initialData[item.name]?._meta?.disable,
);
setPlugins(initialData);
setEnablePluginsList(openPluginList);
Expand Down Expand Up @@ -244,16 +244,16 @@ const PluginPage: React.FC<Props> = ({
actions={[
<Button
type={
initialData[item.name] && !initialData[item.name]._meta.disable
initialData[item.name] && !initialData[item.name]?._meta?.disable
? 'primary'
: 'default'
}
danger={initialData[item.name] && !initialData[item.name]._meta.disable}
danger={initialData[item.name] && !initialData[item.name]?._meta?.disable}
onClick={() => {
setName(item.name);
}}
>
{initialData[item.name] && !initialData[item.name]._meta.disable
{initialData[item.name] && !initialData[item.name]?._meta?.disable
? formatMessage({ id: 'component.plugin.disable' })
: formatMessage({ id: 'component.plugin.enable' })}
</Button>,
Expand Down

0 comments on commit 862b9c1

Please sign in to comment.