Skip to content

fix: handle entity type selection on mobile - #1631

Open
IceeAn wants to merge 1 commit into
sysadminsmedia:mainfrom
IceeAn:fix/mobile-dropdown
Open

fix: handle entity type selection on mobile#1631
IceeAn wants to merge 1 commit into
sysadminsmedia:mainfrom
IceeAn:fix/mobile-dropdown

Conversation

@IceeAn

@IceeAn IceeAn commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • bug

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

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Bug Fixes
    • Ensured entity types are loaded before opening the create-entity dialog.
    • Improved entity-type selection behavior by preventing duplicate updates and closing the selector after a choice is made.

Walkthrough

Entity 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.

Changes

Entity type selection

Layer / File(s) Summary
Load entity types before modal initialization
frontend/components/Entity/CreateModal.vue
The create-entity dialog callback awaits entityTypeStore.ensureFetched() before using the available entity types.
Stabilize entity type dropdown selection
frontend/components/Entity/Selector.vue
The selector controls open state, routes item and model updates through one handler, synchronizes selected state, avoids duplicate callbacks, and closes after selection.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: tonyaellie

Poem

Types arrive before the door swings wide,
Choices settle instead of sliding aside.
One tap calls once, then dropdowns close—
A smoother path wherever selections go.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the mobile entity type selection fix.
Description check ✅ Passed The description covers the PR type, motivation, file-level changes, and linked issue, though testing and reviewer notes are omitted.
Linked Issues check ✅ Passed The changes address issue #1617 by fixing mobile selection handling and ensuring entity types are loaded before opening the create modal.
Out of Scope Changes check ✅ Passed The changes stay focused on the reported mobile entity-type selection bug with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified 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.

❤️ Share

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

@coderabbitai
coderabbitai Bot requested a review from tonyaellie July 24, 2026 09:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
frontend/components/Entity/Selector.vue (1)

31-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the selection event paths.

Please test: item click followed by update:model-value invokes the callback once, model updates alone still invoke it, and external selectedEntityType changes 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

📥 Commits

Reviewing files that changed from the base of the PR and between 52eb6f3 and 7e16e46.

📒 Files selected for processing (2)
  • frontend/components/Entity/CreateModal.vue
  • frontend/components/Entity/Selector.vue

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.

Mobile Safari entity-type dropdown reverts to most recent; item creation never submits

1 participant