Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: plugin config page error #2739

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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