Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SettingDescription } from "../shared/setting-description";
const watchPathsSchema = z.object({
paths: z.array(
z.object({
value: z.string().min(1, "Pattern cannot be empty"),
value: z.string(),
}),
),
});
Expand Down Expand Up @@ -45,6 +45,7 @@ export const WatchPaths = () => {
handleSubmit,
formState: { isValid, isSubmitting, errors },
control,
reset,
} = useForm<WatchPathsForm>({
resolver: zodResolver(watchPathsSchema),
mode: "onChange",
Expand Down Expand Up @@ -91,9 +92,20 @@ export const WatchPaths = () => {
updateAllEnvironments((draft) => {
draft.watchPaths = watchPaths;
});
reset({ paths: toFormPaths(watchPaths) });
};

const displayValue = defaultPaths.length > 0 ? defaultPaths.join(", ") : "All files (no filter)";
const displayValue =
defaultPaths.length > 0 ? (
<span className="flex items-center gap-1 truncate">
<span className="truncate">{defaultPaths[0]}</span>
{defaultPaths.length > 1 && (
<span className="shrink-0 text-gray-9">+{defaultPaths.length - 1}</span>
)}
</span>
) : (
"All files (no filter)"
);

return (
<FormSettingCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const SelectedConfig = ({ label, className = "" }: SelectedConfigProps) =
<Badge
variant="secondary"
className={cn(
"px-3 py-2 text-gray-11 text-[13px] border-grayA-4 bg-transparent hover:bg-grayA-3 cursor-default hover:text-gray-12 rounded-md focus:hover:bg-transparent h-7",
"px-3 py-2 text-gray-11 text-[13px] border-grayA-4 bg-transparent hover:bg-grayA-3 cursor-default hover:text-gray-12 rounded-md focus:hover:bg-transparent h-7 max-w-full overflow-hidden",
className,
)}
>
Expand Down
Loading