fix: handle entity type selection on mobile - #1631
Conversation
Summary by CodeRabbit
WalkthroughEntity creation now ensures entity types are fetched before initializing the modal. The entity-type selector tracks dropdown state and the handled selection locally, synchronizes prop changes, suppresses duplicate callbacks, and closes after selection. ChangesEntity type selection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
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.
🧹 Nitpick comments (1)
frontend/components/Entity/Selector.vue (1)
31-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression coverage for the selection event paths.
Please test: item click followed by
update:model-valueinvokes the callback once, model updates alone still invoke it, and externalselectedEntityTypechanges do not get swallowed by the deduplication state.🤖 Prompt for 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. In `@frontend/components/Entity/Selector.vue` around lines 31 - 57, Add regression tests for Selector.vue’s selectEntityType and selectedEntityType watcher covering item click followed by update:model-value without duplicate callback invocation, model-only updates invoking the callback, and external selectedEntityType changes remaining distinct from handledEntityTypeId so later selections are not incorrectly deduplicated.
🤖 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.
Nitpick comments:
In `@frontend/components/Entity/Selector.vue`:
- Around line 31-57: Add regression tests for Selector.vue’s selectEntityType
and selectedEntityType watcher covering item click followed by
update:model-value without duplicate callback invocation, model-only updates
invoking the callback, and external selectedEntityType changes remaining
distinct from handledEntityTypeId so later selections are not incorrectly
deduplicated.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a0154ddf-5b3b-4759-a72c-17fafde8a33f
📒 Files selected for processing (2)
frontend/components/Entity/CreateModal.vuefrontend/components/Entity/Selector.vue
What type of PR is this?
What this PR does / why we need it:
This PR fixes entity type selection in the create and edit page on mobile browsers, where selecting a type could revert to the first type.
frontend/components/Entity/CreateModal.vue: Waits for entity types to finish loading before initializing the create dialog.frontend/components/Entity/Selector.vue: Handles both item click and model update events to support mobile selection behavior. Deduplicates selection events when the change callback invoked twice.Which issue(s) this PR fixes:
Fixes #1617