Skip to content

Conversation

@harshtandiya
Copy link
Collaborator

@harshtandiya harshtandiya commented Jan 14, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a "Hidden" toggle to form field properties to hide fields by default
    • Hidden fields can now be conditionally displayed through existing visibility rules

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

This PR adds a "hidden" field property to form fields, enabling them to be hidden by default. The feature is implemented across the backend schema and Python models, with corresponding frontend type definitions, UI controls, and visibility logic updates to respect the base hidden state.

Changes

Cohort / File(s) Summary
Backend Model & Schema
forms_pro/forms_pro/doctype/form_field/form_field.json, forms_pro/forms_pro/doctype/form_field/form_field.py
Added hidden field (Check type, default "0") to Form Field DocType with corresponding Python type annotation for static analysis
Frontend Type Definition
frontend/src/types/formfield.ts
Added optional hidden?: boolean property to FormField type
Frontend UI Component
frontend/src/components/builder/field-editor/FieldPropertiesForm.vue
Added "Hidden" checkbox control to field properties editor with description text
Frontend Visibility Logic
frontend/src/utils/conditionals.ts
Updated shouldFieldBeVisible to use base hidden state as default visibility, with conditional logic rules able to override it

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • feat: conditional logic v1 #23: Introduced ShowField/HideField conditional logic rules that this PR extends by adding per-field hidden state as the base visibility layer.

Poem

🐰 A hidden property hops in with grace,
Through schemas and types it finds its place,
Frontend and backend now dance as one,
Fields can be shy—visibility's fun! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: hide fields property' accurately describes the main change: adding a hidden field property to form fields across the backend and frontend.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
frontend/src/utils/conditionals.ts (1)

260-284: ShowField takes precedence over HideField when both are met.

When multiple rules target the same field and both ShowField and HideField conditions are satisfied simultaneously, ShowField wins due to the order of checks (lines 274-276 before 279-281). This behavior seems reasonable but consider adding a brief comment noting this precedence if it's intentional.

📝 Optional: Document the precedence
   // Conditional logic overrides base state:
-  // - "Show Field" action can override hidden state (make it visible)
+  // - "Show Field" action can override hidden state (make it visible)
+  // - Note: ShowField takes precedence if both Show and Hide rules are met
   if (hasShowRule) {
     return true;
   }

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 848eb28 and fb2d300.

📒 Files selected for processing (5)
  • forms_pro/forms_pro/doctype/form_field/form_field.json
  • forms_pro/forms_pro/doctype/form_field/form_field.py
  • frontend/src/components/builder/field-editor/FieldPropertiesForm.vue
  • frontend/src/types/formfield.ts
  • frontend/src/utils/conditionals.ts
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/utils/conditionals.ts (2)
frontend/src/types/formfield.ts (1)
  • FormField (20-31)
forms_pro/forms_pro/doctype/form_field/form_field.py (1)
  • FormField (8-76)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Server
🔇 Additional comments (6)
forms_pro/forms_pro/doctype/form_field/form_field.py (2)

39-39: LGTM on the type annotation.

The hidden: DF.Check type annotation correctly aligns with the JSON schema definition.


68-76: The omission of hidden from the to_frappe_field dictionary appears intentional. The property is not included in the returned field metadata, and the update logic in form.py (line 13) explicitly enumerates which properties to synchronize: ["label", "fieldtype", "reqd", "options", "description", "default"]. The hidden property is correctly excluded from both, confirming it is form-builder-UI-scoped and does not propagate to Frappe's internal field handling.

frontend/src/components/builder/field-editor/FieldPropertiesForm.vue (1)

59-67: LGTM!

The new "hidden" checkbox property follows the established pattern and integrates well with the existing field properties. The description clearly communicates the behavior to users.

frontend/src/types/formfield.ts (1)

26-26: LGTM!

The optional boolean type correctly represents the backend Check field and integrates properly with the visibility logic in conditionals.ts.

frontend/src/utils/conditionals.ts (1)

235-237: LGTM on the base visibility derivation.

The logic !field.hidden correctly inverts the hidden flag to determine base visibility, handling undefined as visible by default (falsy → !undefined = true).

forms_pro/forms_pro/doctype/form_field/form_field.json (1)

73-78: LGTM!

The field definition correctly uses Check fieldtype with a sensible default of "0" (visible by default). The placement in field_order after reqd maintains logical grouping of field properties.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harshtandiya harshtandiya merged commit 946d0d7 into develop Jan 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants