Skip to content

Commit

Permalink
LPS-118100 Update SelectField if value prop is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
p2kmgcl authored and pavel-savinov committed Nov 20, 2020
1 parent a5d4c36 commit d37c9c4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import ClayForm, {ClaySelectWithOption} from '@clayui/form';
import PropTypes from 'prop-types';
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';

import {useStyleBook} from '../../../plugins/page-design-options/hooks/useStyleBook';
import {ConfigurationFieldPropTypes} from '../../../prop-types/index';
Expand Down Expand Up @@ -47,6 +47,10 @@ export const SelectField = ({disabled, field, onValueSelect, value}) => {
};
};

useEffect(() => {
setNextValue((prevValue) => value || prevValue);
}, [value]);

return (
<ClayForm.Group small>
<label htmlFor={inputId}>{field.label}</label>
Expand Down

0 comments on commit d37c9c4

Please sign in to comment.