diff --git a/web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/watch-paths-settings.tsx b/web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/watch-paths-settings.tsx index 588c797194..c7075114ca 100644 --- a/web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/watch-paths-settings.tsx +++ b/web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/watch-paths-settings.tsx @@ -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(), }), ), }); @@ -45,6 +45,7 @@ export const WatchPaths = () => { handleSubmit, formState: { isValid, isSubmitting, errors }, control, + reset, } = useForm({ resolver: zodResolver(watchPathsSchema), mode: "onChange", @@ -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 ? ( + + {defaultPaths[0]} + {defaultPaths.length > 1 && ( + +{defaultPaths.length - 1} + )} + + ) : ( + "All files (no filter)" + ); return (