diff --git a/packages/app/src/pages/settings/components/SettingTab/index.jsx b/packages/app/src/pages/settings/components/SettingTab/index.jsx
index e223d73b..603a94f0 100755
--- a/packages/app/src/pages/settings/components/SettingTab/index.jsx
+++ b/packages/app/src/pages/settings/components/SettingTab/index.jsx
@@ -4,141 +4,166 @@ import { Translation } from "react-i18next"
import { Icons } from "@components/Icons"
-import {
- composedTabs,
- composeGroupsFromSettingsTab,
-} from "@/settings"
+import { composedTabs, composeGroupsFromSettingsTab } from "@/settings"
import groupsDecorators from "@config/settingsGroupsDecorators"
import SettingItemComponent from "../SettingItemComponent"
export default class SettingTab extends React.Component {
- state = {
- loading: true,
- tab: null,
- ctx: {},
- }
+ state = {
+ loading: true,
+ tab: null,
+ ctx: {},
+ }
- loadTab = async () => {
- await this.setState({
- loading: true,
- processedCtx: {},
- })
+ loadTab = async () => {
+ await this.setState({
+ loading: true,
+ processedCtx: {},
+ })
- const tab = composedTabs[this.props.activeKey]
+ const tab = composedTabs[this.props.activeKey]
- let ctx = {}
+ let ctx = {}
- if (typeof tab.ctxData === "function") {
- ctx = await tab.ctxData()
- }
+ if (typeof tab.ctxData === "function") {
+ ctx = await tab.ctxData()
+ }
- await this.setState({
- tab: tab,
- loading: false,
- ctx: {
- baseConfig: this.props.baseConfig,
- ...ctx
- },
- })
- }
+ if (typeof tab.onLoad === "function") {
+ await tab.onLoad(ctx)
+ }
- // check if props.activeKey change
- componentDidUpdate = async (prevProps) => {
- if (prevProps.activeKey !== this.props.activeKey) {
- await this.loadTab()
- }
- }
+ await this.setState({
+ tab: tab,
+ loading: false,
+ ctx: {
+ baseConfig: this.props.baseConfig,
+ ...ctx,
+ },
+ })
+ }
- componentDidMount = async () => {
- await this.loadTab()
- }
+ // check if props.activeKey change
+ componentDidUpdate = async (prevProps) => {
+ if (prevProps.activeKey !== this.props.activeKey) {
+ await this.loadTab()
+ }
+ }
- handleSettingUpdate = async (key, value) => {
- if (typeof this.props.onUpdate === "function") {
- await this.props.onUpdate(key, value)
- }
- }
+ componentDidMount = async () => {
+ await this.loadTab()
+ }
- render() {
- if (this.state.loading) {
- return