From d9d423c0551799d833ae4419ec0833fb6f7041c1 Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Fri, 18 May 2018 22:35:58 +0300 Subject: [PATCH] force clear & set value in input on mount / unmount --- web/app/components/input/input.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/components/input/input.jsx b/web/app/components/input/input.jsx index cbce5e05..32c0b437 100644 --- a/web/app/components/input/input.jsx +++ b/web/app/components/input/input.jsx @@ -29,7 +29,7 @@ export default class Input extends Component { } componentDidMount() { - const { mods = {} } = this.props; + const { mods = {}, value } = this.props; if (this.props.autoFocus) { this.fieldNode.focus(); @@ -38,6 +38,7 @@ export default class Input extends Component { if (mods.mode !== 'edit') { this.fieldNode.value = ''; } else { + this.fieldNode.value = value; this.autoResize(); } @@ -46,6 +47,10 @@ export default class Input extends Component { }); } + componentWillUnmount() { + this.fieldNode.value = ''; + } + shouldComponentUpdate(nextProps) { return nextProps.id !== this.props.id || nextProps.pid !== this.props.pid