-
Notifications
You must be signed in to change notification settings - Fork 69
Description
We are encountering a race condition when initializing the component and immediately attempting to call methods like select.open() on the dynamically created element. The method often executes too early, before the component's internal structure (specifically, the full setup within afterRenderWrapper and initDropboxPopover) is complete.
This requires developers to rely on unreliable workarounds like setTimeout or manual polling (setInterval checking for select.virtualSelect), which leads to fragile and complex code.
Proposed Solution
Please introduce an optional onInit (or onReady) callback within the options object passed to VirtualSelect.init().
This callback function should execute after the component has fully completed its internal initialization process, specifically:
After the new VirtualSelect() constructor completes.
After the entire execution of the this.afterRenderWrapper() method (where all DOM events, styling, and the PopoverComponent are initialized).
Example of the Desired Reliable Usage:
const config = {
// ... other options ...
// New onInit option
onInit: function(instance) {
// The component is guaranteed ready here!
instance.open();
}
}
VirtualSelect.init(config);