fix: Form Builder Name Field Shows Default Label When Custom Label is Empty#24201
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe PR makes minor cleanups in FormBuilder components and updates label handling. It removes unused variables and inline eslint comments, and simplifies a truthiness check for rendering a component. The functional change is in FieldLabel: when the computed label is empty, it now derives and renders a default label from the field configuration (variants map), instead of leaving the label blank. No exported or public API declarations were changed. Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
|
@kartik-212004 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/web/modules/bookings/views/bookings-listing-view.tsx(3 hunks)packages/features/form-builder/FormBuilder.tsx(4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Always use
t()for text localization in frontend code; direct text embedding should trigger a warning
Files:
packages/features/form-builder/FormBuilder.tsxapps/web/modules/bookings/views/bookings-listing-view.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
packages/features/form-builder/FormBuilder.tsxapps/web/modules/bookings/views/bookings-listing-view.tsx
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
packages/features/form-builder/FormBuilder.tsxapps/web/modules/bookings/views/bookings-listing-view.tsx
🧠 Learnings (1)
📓 Common learnings
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
🧬 Code graph analysis (1)
apps/web/modules/bookings/views/bookings-listing-view.tsx (1)
packages/features/data-table/components/DataTableWrapper.tsx (1)
DataTableWrapper(44-154)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (4)
packages/features/form-builder/FormBuilder.tsx (3)
429-429: LGTM: Clean removal of unused comment.Removing unused comments improves code cleanliness without affecting behavior.
701-701: LGTM: Simplified truthiness check.Removing the double-negation makes the code cleaner while maintaining the same behavior.
902-909: Core fix looks good, but consider whitespace-only labels.The fallback logic correctly addresses the PR objective by falling back to the default translated label when the custom label is empty. The implementation properly uses
t()for localization as required.However, the PR description mentions the bug occurs when the label "contains only whitespace," but the current check
!labelonly catches empty strings, not whitespace-only strings like" ".Consider whether whitespace-only labels should also trigger the fallback. If so, apply this diff:
// If no custom label is set, fall back to the defaultLabel from field config - if (!label) { + if (!label || !label.trim()) { const fieldName =As per coding guidelines.
apps/web/modules/bookings/views/bookings-listing-view.tsx (1)
379-395: Error guard keeps table state saneNice touch short-circuiting
finalDatawhen the query errors—this prevents stale rows from leaking into the table and keeps the wrapper’s empty/error view logic consistent.
f376f0c to
87a7bb9
Compare
87a7bb9 to
bce9e59
Compare
pallava-joshi
left a comment
There was a problem hiding this comment.
tested locally, working fine.
E2E results are ready! |
Devin AI is resolving merge conflictsThis PR has merge conflicts with the Devin will:
If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself. |
Devin AI is resolving merge conflictsThis PR has merge conflicts with the Devin will:
If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself. |
Co-authored-by: Cursor <cursoragent@cursor.com>
…der.tsx Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
What does this PR do?
Fixes #24200
Fixes CAL-6498
FieldLabelcomponent to properly handle empty or meaningless labelsProblem: In the Event Types form builder, when the custom label for the "name" field is removed or empty, it shows no label or the raw field identifier (like "your_name") instead of falling back to "Name" like the email field correctly shows "Email address".
Solution: Updated the
FieldLabelcomponent to check if a label is meaningful (not empty and not the same as the field name) before using it, otherwise fall back to the translated default label.Visual Demo (For contributors especially)
Before:
2025-10-01.14-49-12.mp4
After:
2025-10-01.14-52-36.mp4
Image Demo:
Before:
After:
Mandatory Tasks (DO NOT REMOVE)
Steps to Reproduce