feat: add tooltip to itemSource for mapping requirements - #1266
Conversation
Adds a tooltip to the Parent field when in Entity mode that explains that "List elements must be able to satisfy the mapping requirements." The required fields are listed in the message aswell.
WalkthroughThe visual editor derives unique field type requirements from repeated entity field item sources and passes them to Sequence Diagram(s)sequenceDiagram
participant Editor as Repeated entity field selector
participant Toggler as Constant value mode toggler
participant Tooltip as Requirements tooltip
Editor->>Toggler: Pass normalized item source requirements
Toggler->>Tooltip: Render info button when constant mode is disabled
Tooltip-->>Editor: Display localized requirement types
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/visual-editor/locales/platform/en/visual-editor.json`:
- Line 560: Update the expected tooltip text in
EntityFieldSelectorField.test.tsx to match the current
itemSourceParentFieldTooltip locale copy: “List elements must be able to satisfy
the mapping requirements:”. Replace the stale “List fields must have
children...” assertion and leave the locale and component unchanged.
In `@packages/visual-editor/src/fields/EntityFieldSelectorField.test.tsx`:
- Around line 628-631: The tooltip text assertion in the
EntityFieldSelectorField test uses wording that differs from the component’s
default string. Update the assertion to expect “List elements must be able to
satisfy the mapping requirements:” while preserving the existing tooltip lookup
and assertion structure.
In `@packages/visual-editor/src/fields/EntityFieldSelectorField.tsx`:
- Around line 84-87: Remove the module-level
ITEM_SOURCE_PARENT_FIELD_TOOLTIP_TITLE translation and call
pt("itemSourceParentFieldTooltip", ...) inside the component render path where
the tooltip title is used, alongside the existing parentFieldRequirements
translation pattern, so the value updates when the locale changes.
- Around line 247-249: Update the infoTooltipRequirements prop in
EntityFieldSelectorField to access itemSourceTypes through optional chaining on
field.filter, allowing undefined to be passed safely to
getItemSourceTooltipRequirements without throwing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 20a11072-ab9d-47f3-8d2c-42e4bd4e2c9f
📒 Files selected for processing (27)
packages/visual-editor/locales/platform/cs/visual-editor.jsonpackages/visual-editor/locales/platform/da/visual-editor.jsonpackages/visual-editor/locales/platform/de/visual-editor.jsonpackages/visual-editor/locales/platform/en-GB/visual-editor.jsonpackages/visual-editor/locales/platform/en/visual-editor.jsonpackages/visual-editor/locales/platform/es/visual-editor.jsonpackages/visual-editor/locales/platform/et/visual-editor.jsonpackages/visual-editor/locales/platform/fi/visual-editor.jsonpackages/visual-editor/locales/platform/fr/visual-editor.jsonpackages/visual-editor/locales/platform/hr/visual-editor.jsonpackages/visual-editor/locales/platform/hu/visual-editor.jsonpackages/visual-editor/locales/platform/it/visual-editor.jsonpackages/visual-editor/locales/platform/ja/visual-editor.jsonpackages/visual-editor/locales/platform/lt/visual-editor.jsonpackages/visual-editor/locales/platform/lv/visual-editor.jsonpackages/visual-editor/locales/platform/nb/visual-editor.jsonpackages/visual-editor/locales/platform/nl/visual-editor.jsonpackages/visual-editor/locales/platform/pl/visual-editor.jsonpackages/visual-editor/locales/platform/pt/visual-editor.jsonpackages/visual-editor/locales/platform/ro/visual-editor.jsonpackages/visual-editor/locales/platform/sk/visual-editor.jsonpackages/visual-editor/locales/platform/sv/visual-editor.jsonpackages/visual-editor/locales/platform/tr/visual-editor.jsonpackages/visual-editor/locales/platform/zh-TW/visual-editor.jsonpackages/visual-editor/locales/platform/zh/visual-editor.jsonpackages/visual-editor/src/fields/EntityFieldSelectorField.test.tsxpackages/visual-editor/src/fields/EntityFieldSelectorField.tsx
auto-screenshot-update: true
Adds a tooltip to the Parent field when in Entity mode that explains that "List elements must be able to satisfy the mapping requirements."
The required fields are listed in the message aswell.
This works for both itemSource and slottedItemSource.