mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor(site): replace double-negation with Boolean() in AgentsPage (#22814)
This commit is contained in:
@@ -421,11 +421,13 @@ export const AgentChatInput = memo<AgentChatInputProps>(
|
||||
|
||||
// Track whether the editor has content so we can gate the
|
||||
// send button without a controlled value prop.
|
||||
const [hasContent, setHasContent] = useState(() => !!initialValue?.trim());
|
||||
const [hasContent, setHasContent] = useState(() =>
|
||||
Boolean(initialValue?.trim()),
|
||||
);
|
||||
|
||||
const handleContentChange = useCallback(
|
||||
(content: string) => {
|
||||
setHasContent(!!content.trim());
|
||||
setHasContent(Boolean(content.trim()));
|
||||
onContentChange?.(content);
|
||||
},
|
||||
[onContentChange],
|
||||
|
||||
@@ -111,7 +111,7 @@ const InputField: FC<
|
||||
placeholder={placeholder}
|
||||
{...fieldProps}
|
||||
disabled={disabled}
|
||||
aria-invalid={!!fieldError}
|
||||
aria-invalid={Boolean(fieldError)}
|
||||
aria-describedby={fieldError ? errorId : undefined}
|
||||
/>
|
||||
{fieldError && (
|
||||
@@ -171,7 +171,7 @@ const SelectField: FC<
|
||||
"h-9 min-w-0 text-[13px]",
|
||||
fieldError && "border-content-destructive",
|
||||
)}
|
||||
aria-invalid={!!fieldError}
|
||||
aria-invalid={Boolean(fieldError)}
|
||||
aria-describedby={fieldError ? errorId : undefined}
|
||||
>
|
||||
<SelectValue placeholder="Unset" />
|
||||
@@ -235,7 +235,7 @@ const JSONField: FC<
|
||||
placeholder={placeholder}
|
||||
{...fieldProps}
|
||||
disabled={disabled}
|
||||
aria-invalid={!!fieldError}
|
||||
aria-invalid={Boolean(fieldError)}
|
||||
aria-describedby={fieldError ? errorId : undefined}
|
||||
/>
|
||||
{fieldError && (
|
||||
|
||||
Reference in New Issue
Block a user