Skip to content

Commit

Permalink
Fix #3081: maintain p-filled properly (#3082)
Browse files Browse the repository at this point in the history
* fix for renamed parameter before merging #2611

* Fix #3081: maintain p-filled properly

* lint

* remove extra braces
  • Loading branch information
kalinkrustev authored Aug 2, 2022
1 parent 420dc32 commit 5e60927
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions components/lib/inputtext/InputText.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export const InputText = React.memo(React.forwardRef((props, ref) => {
}
}

const currentValue = elementRef.current && elementRef.current.value;
const isFilled = React.useMemo(() => (
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || (elementRef.current && ObjectUtils.isNotEmpty(elementRef.current.value))
), [props.value, props.defaultValue]);
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || ObjectUtils.isNotEmpty(currentValue)
), [props.value, props.defaultValue, currentValue]);

React.useEffect(() => {
ObjectUtils.combinedRefs(elementRef, ref);
Expand Down
5 changes: 3 additions & 2 deletions components/lib/inputtextarea/InputTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export const InputTextarea = React.memo(React.forwardRef((props, ref) => {
}
}

const currentValue = elementRef.current && elementRef.current.value;
const isFilled = React.useMemo(() => (
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || (elementRef.current && ObjectUtils.isNotEmpty(elementRef.current.value))
), [props.value, props.defaultValue]);
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || ObjectUtils.isNotEmpty(currentValue)
), [props.value, props.defaultValue, currentValue]);

React.useEffect(() => {
ObjectUtils.combinedRefs(elementRef, ref);
Expand Down
5 changes: 3 additions & 2 deletions components/lib/mention/Mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,10 @@ export const Mention = React.memo(React.forwardRef((props, ref) => {
}
}

const currentValue = inputRef.current && inputRef.current.value;
const isFilled = React.useMemo(() => (
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || (inputRef.current && ObjectUtils.isNotEmpty(inputRef.current.value))
), [props.value, props.defaultValue, inputRef]);
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || ObjectUtils.isNotEmpty(currentValue)
), [props.value, props.defaultValue, currentValue]);

React.useImperativeHandle(ref, () => ({
props,
Expand Down
5 changes: 3 additions & 2 deletions components/lib/password/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export const Password = React.memo(React.forwardRef((props, ref) => {
}, when: overlayVisibleState
});

const currentValue = inputRef.current && inputRef.current.value;
const isFilled = React.useMemo(() => (
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || (inputRef.current && ObjectUtils.isNotEmpty(inputRef.current.value))
), [props.value, props.defaultValue, inputRef]);
ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || ObjectUtils.isNotEmpty(currentValue)
), [props.value, props.defaultValue, currentValue]);

const updateLabels = () => {
if (meterState) {
Expand Down

0 comments on commit 5e60927

Please sign in to comment.