We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a618477 + 382f7bb commit cc71471Copy full SHA for cc71471
packages/brick-kit/src/BrickAsComponent.tsx
@@ -826,11 +826,14 @@ export function ForwardRefSingleBrickAsComponentFactory(React: typeof _React) {
826
827
const onMount = useBrick.lifeCycle?.onMount;
828
if (onMount) {
829
- dispatchLifeCycleEvent(
830
- new CustomEvent("mount"),
831
- transformEvents(data, { onMount }).onMount,
832
- brick
833
- );
+ // wait for element of template brick to be assigned
+ queueMicrotask(() => {
+ dispatchLifeCycleEvent(
+ new CustomEvent("mount"),
+ transformEvents(data, { onMount }).onMount,
834
+ brick
835
+ );
836
+ });
837
}
838
const onScrollIntoView = useBrick.lifeCycle?.onScrollIntoView;
839
if (onScrollIntoView) {
0 commit comments