Fix form height was not re-calculcated when validation error changes

This commit is contained in:
SleepWalker 2019-06-09 10:54:03 +03:00
parent a69ae9d3c6
commit 99fc667a2b
2 changed files with 14 additions and 3 deletions

View File

@ -23,13 +23,15 @@ import { omit, debounce } from 'functions';
* </MeasureHeight> * </MeasureHeight>
*/ */
type ChildState = { [key: string]: any };
export default class MeasureHeight extends PureComponent<{ export default class MeasureHeight extends PureComponent<{
shouldMeasure: (prevState: any, newState: any) => bool, shouldMeasure: (prevState: any, newState: any) => bool,
onMeasure: (height: number) => void, onMeasure: (height: number) => void,
state: any state: ChildState
}> { }> {
static defaultProps = { static defaultProps = {
shouldMeasure: (prevState: any, newState: any) => prevState !== newState, shouldMeasure: (prevState: ChildState, newState: ChildState) => prevState !== newState,
onMeasure: (height: number) => {} // eslint-disable-line onMeasure: (height: number) => {} // eslint-disable-line
}; };

View File

@ -339,8 +339,17 @@ class PanelTransition extends Component {
} }
shouldMeasureHeight() { shouldMeasureHeight() {
const errorString = Object.values(this.props.auth.error || {})
.reduce((acc, item) => {
if (typeof item === 'string') {
return acc + item;
}
return acc + item.type;
}, '');
return [ return [
this.props.auth.error, errorString,
this.state.isHeightDirty, this.state.isHeightDirty,
this.props.user.lang, this.props.user.lang,
this.props.accounts.available.length this.props.accounts.available.length