Skip to content

Commit

Permalink
[Fleet] Do not show error state on input if there are no errors (#157160
Browse files Browse the repository at this point in the history
)

## Summary
Fixes this bug, where there was previously an error with this input but
it has been solved, we still have it in the error state:
<img width="1030" alt="Screenshot 2023-05-09 at 12 26 04"
src="https://github.com/elastic/kibana/assets/3315046/4381523a-d839-4425-af5f-0f56e6aa9199">

Note there is no error message, where a correct error input looks like
this:
<img width="379" alt="Screenshot 2023-05-09 at 12 27 44"
src="https://github.com/elastic/kibana/assets/3315046/4b7a498a-ac9a-46d8-94e1-525f4b090cfd">

The error is simply that `[]` is truthy so was showing as having errors
  • Loading branch information
hop-dev authored May 9, 2023
1 parent cc781e6 commit 5ceeaa0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const PackagePolicyInputVarField: React.FunctionComponent<{
}) => {
const [isDirty, setIsDirty] = useState<boolean>(false);
const { multi, required, type, title, name, description, options } = varDef;
const isInvalid = (isDirty || forceShowErrors) && !!varErrors;
const isInvalid = (isDirty || forceShowErrors) && !!varErrors?.length;
const errors = isInvalid ? varErrors : null;
const fieldLabel = title || name;
const fieldTestSelector = fieldLabel.replace(/\s/g, '-').toLowerCase();
Expand Down

0 comments on commit 5ceeaa0

Please sign in to comment.