Skip to content
Snippets Groups Projects
Unverified Commit 138a8b09 authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

fix parameter input loses value (#23750)

parent 26f4673e
No related branches found
No related tags found
No related merge requests found
...@@ -21,11 +21,6 @@ type State = { ...@@ -21,11 +21,6 @@ type State = {
}; };
class TextWidget extends React.Component<Props, State> { class TextWidget extends React.Component<Props, State> {
state: State = {
value: null,
isFocused: false,
};
static defaultProps = { static defaultProps = {
isEditing: false, isEditing: false,
commitImmediately: false, commitImmediately: false,
...@@ -34,6 +29,11 @@ class TextWidget extends React.Component<Props, State> { ...@@ -34,6 +29,11 @@ class TextWidget extends React.Component<Props, State> {
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
this.state = {
value: props.value,
isFocused: false,
};
} }
static noPopover = true; static noPopover = true;
...@@ -43,7 +43,7 @@ class TextWidget extends React.Component<Props, State> { ...@@ -43,7 +43,7 @@ class TextWidget extends React.Component<Props, State> {
} }
UNSAFE_componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.value !== this.state.value) { if (nextProps.value !== this.props.value) {
this.setState({ value: nextProps.value }, () => { this.setState({ value: nextProps.value }, () => {
// HACK: Address Safari rendering bug which causes https://github.com/metabase/metabase/issues/5335 // HACK: Address Safari rendering bug which causes https://github.com/metabase/metabase/issues/5335
forceRedraw(ReactDOM.findDOMNode(this)); forceRedraw(ReactDOM.findDOMNode(this));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment