Files
supabase/apps
Claude 7b1dd94c79 use zod schema validation for object-versioning fields, not manual setError
- Move min/max/required validation for version_expiry_days and
  max_noncurrent_versions into a shared superRefine (BucketDataProtectionFields.schema.ts),
  called from each modal's own superRefine, instead of imperative
  validateVersioningFields() + form.setError() calls in onSubmit. Errors
  now surface the same way as the rest of the form (FormItemLayout/FormMessage),
  matching Studio's established form-error convention.
- Switch the fields to the '' empty-sentinel + z.coerce.number() union
  pattern (per the react-hook-form skill) instead of z.string().optional(),
  keeping inputs fully controlled without special-casing undefined.
- Build each modal's schema dynamically via useMemo(() => schema(planLimits), ...)
  since the versioning bounds depend on the async-loaded org plan.
- Replace destructured useFormContext().watch() with useWatch({ control, name })
  in BucketDataProtectionFields, avoiding the ratcheted no-use-watch lint warning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiUEvmC84bRsteqsWXHY2p
2026-08-05 15:55:16 +00:00
..