fix: ensure atomic-search-interface waits for all child components to be defined before completing initialization #6593
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
atomic-search-interfaceinitialization could complete before all child components (particularly dynamically loaded ones) were fully defined, causing incomplete state or runtime errors when child components likeatomic-facetloaded asynchronously.Changes
waitForAllVanillaChildrenComponentsToBeDefined()method inatomic-search-interface.tsATOMIC-customElements.whenDefined()to wait for each component definitioninternalInitialization()after bindings setup but before URL manager initializationImplementation
This ensures that when a facet or other child component's JavaScript is delayed (network latency, code splitting, etc.), initialization will properly wait rather than proceeding with undefined components.
Testing
Create an HTML page with a custom delayed component to verify:
Without this fix, initialization completes in <100ms and may fail or have incomplete state.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.