diff --git a/packages/app/constants/settings/components/urlInput/index.jsx b/packages/app/constants/settings/components/urlInput/index.jsx index 6106ae4b..f57ddae8 100755 --- a/packages/app/constants/settings/components/urlInput/index.jsx +++ b/packages/app/constants/settings/components/urlInput/index.jsx @@ -7,6 +7,10 @@ import "./index.less" export default (props) => { const [value, setValue] = React.useState(props.ctx.currentValue) + React.useEffect(() => { + setValue(props.ctx.currentValue) + }, [props.ctx.currentValue]) + return
{ !props.noPreview && value &&
diff --git a/packages/app/constants/settings/profile/index.jsx b/packages/app/constants/settings/profile/index.jsx index ba599304..e692efac 100755 --- a/packages/app/constants/settings/profile/index.jsx +++ b/packages/app/constants/settings/profile/index.jsx @@ -1,4 +1,3 @@ -import React from "react" import UserModel from "models/user" import loadable from "@loadable/component" import UploadButton from "components/UploadButton" @@ -105,7 +104,6 @@ export default { UploadButton ], "defaultValue": (ctx) => { - console.log(ctx) return ctx.userData.avatar }, "onUpdate": async (value) => { @@ -118,7 +116,6 @@ export default { return value } }, - "debounced": true, }, { "id": "cover", @@ -143,7 +140,6 @@ export default { return value } }, - "debounced": true, }, { "id": "description", diff --git a/packages/app/src/pages/settings/components/SettingItemComponent/index.jsx b/packages/app/src/pages/settings/components/SettingItemComponent/index.jsx index 0616a08c..d2d135dd 100644 --- a/packages/app/src/pages/settings/components/SettingItemComponent/index.jsx +++ b/packages/app/src/pages/settings/components/SettingItemComponent/index.jsx @@ -419,6 +419,7 @@ export default class SettingItemComponent extends React.PureComponent { currentValue: this.state.value, dispatchUpdate: this.dispatchUpdate, onUpdateItem: this.onUpdateItem, + processedCtx: this.props.ctx, }, ref: this.componentRef, @@ -469,7 +470,18 @@ export default class SettingItemComponent extends React.PureComponent { { this.props.setting.extraActions.map((action, index) => { if (typeof action === "function") { - return React.createElement(action) + return React.createElement(action, { + ctx: { + updateCurrentValue: (updateValue) => this.setState({ + value: updateValue + }), + getCurrentValue: () => this.state.value, + currentValue: this.state.value, + dispatchUpdate: this.dispatchUpdate, + onUpdateItem: this.onUpdateItem, + processedCtx: this.props.ctx + }, + }) } const handleOnClick = () => {