mirror of
				https://github.com/elyby/accounts-frontend.git
				synced 2025-05-31 14:11:58 +05:30 
			
		
		
		
	Fix form height was not re-calculcated when validation error changes
This commit is contained in:
		@@ -23,13 +23,15 @@ import { omit, debounce } from 'functions';
 | 
			
		||||
 * </MeasureHeight>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
type ChildState = { [key: string]: any };
 | 
			
		||||
 | 
			
		||||
export default class MeasureHeight extends PureComponent<{
 | 
			
		||||
    shouldMeasure: (prevState: any, newState: any) => bool,
 | 
			
		||||
    onMeasure: (height: number) => void,
 | 
			
		||||
    state: any
 | 
			
		||||
    state: ChildState
 | 
			
		||||
}> {
 | 
			
		||||
    static defaultProps = {
 | 
			
		||||
        shouldMeasure: (prevState: any, newState: any) => prevState !== newState,
 | 
			
		||||
        shouldMeasure: (prevState: ChildState, newState: ChildState) => prevState !== newState,
 | 
			
		||||
        onMeasure: (height: number) => {} // eslint-disable-line
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -339,8 +339,17 @@ class PanelTransition extends Component {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    shouldMeasureHeight() {
 | 
			
		||||
        const errorString = Object.values(this.props.auth.error || {})
 | 
			
		||||
            .reduce((acc, item) => {
 | 
			
		||||
                if (typeof item === 'string') {
 | 
			
		||||
                    return acc + item;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return acc + item.type;
 | 
			
		||||
            }, '');
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            this.props.auth.error,
 | 
			
		||||
            errorString,
 | 
			
		||||
            this.state.isHeightDirty,
 | 
			
		||||
            this.props.user.lang,
 | 
			
		||||
            this.props.accounts.available.length
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user