Skip to content

IBX-11260: Fixed dropdown lazy initialization for dynamically populated translation selects#1834

Merged
ciastektk merged 3 commits intomainfrom
admin-ui-dropdown-lazy-options-fix
Mar 11, 2026
Merged

IBX-11260: Fixed dropdown lazy initialization for dynamically populated translation selects#1834
ciastektk merged 3 commits intomainfrom
admin-ui-dropdown-lazy-options-fix

Conversation

@mikadamczyk
Copy link
Contributor

@mikadamczyk mikadamczyk commented Feb 24, 2026

🎫 Issue IBX-11260

Related PRs:

Description:

This PR fixes an ibexa.core.Dropdown initialization edge case that caused empty option lists in dynamically populated translation modals (for example, the Content Tree “Add translation” modal).

The regression appeared when a dropdown was initialized while its underlying <select> had no options yet, and the options were added later by JavaScript. In that case, the dropdown instance was left in a partially initialized state and did not properly reflect later option updates.

Root cause:

Dropdown.init() returned early when the source <select> had no options. This prevented full UI initialization (itemsPopover) and also blocked proper refresh behavior for options added later.

As a result, consumers who dynamically rebuild <select> options (like Content Tree translation modal) ended up with:

  • native <select> containing correct options
  • custom dropdown UI still showing an empty list
What changed
  • Introduced deferred/lazy UI initialization path in ibexa.core.Dropdown
  • Extracted dropdown UI setup into initializeDropdownUI()
  • Attached observers before the "no options" early return
  • When options are added later, the mutation observer now:
    • completes dropdown UI initialization (if not initialized yet)
    • then calls recreateOptions()
Why this fix is in admin-ui

The issue is in the shared dropdown component lifecycle, not in Content Tree logic itself. Fixing it in admin-ui removes the need for consumer-level workarounds (manual instance reset / re-init) and benefits any feature that uses dynamically populated dropdown options. If this fix is merged, then https://github.com/ibexa/content-tree/pull/113 should be closed.

Impact
  • Fixes empty source language list in Content Tree “Add translation” modal (first open)
  • Keeps existing dropdown behavior unchanged for statically initialized dropdowns

For QA:

Documentation:

@mikadamczyk mikadamczyk self-assigned this Feb 24, 2026
@mikadamczyk mikadamczyk marked this pull request as ready for review February 24, 2026 11:24
@mikadamczyk mikadamczyk requested a review from a team February 24, 2026 11:24
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 bot removed the request for review from a team February 24, 2026 11:24
@KamilSznajdrowicz KamilSznajdrowicz force-pushed the admin-ui-dropdown-lazy-options-fix branch from 7d963fc to 31eb632 Compare March 9, 2026 10:01
Copy link
Contributor

@KamilSznajdrowicz KamilSznajdrowicz left a comment

Choose a reason for hiding this comment

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

QA Approved - sanities and regression pass

CI Fix here: #1845

@KamilSznajdrowicz KamilSznajdrowicz changed the title Fixed dropdown lazy initialization for dynamically populated translation selects IBX-11260: Fixed dropdown lazy initialization for dynamically populated translation selects Mar 10, 2026
@sonarqubecloud
Copy link

@ciastektk ciastektk merged commit b7cdbc4 into main Mar 11, 2026
26 checks passed
@ciastektk ciastektk deleted the admin-ui-dropdown-lazy-options-fix branch March 11, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants