Skip to content

Commit b2ca731

Browse files
committed
final
1 parent 5f6454e commit b2ca731

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

packages/react/src/components/uiComponents.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ export const PricingTable = withClerk(
579579
({ clerk, component, fallback, ...props }: WithClerkProp<PricingTableProps & FallbackProp>) => {
580580
const mountingStatus = useWaitForComponentMount(component, { selector: '[data-ready="true"]' });
581581
const shouldShowFallback = mountingStatus === 'rendering' || !clerk.loaded;
582-
console.log('shouldShowFallback', shouldShowFallback, mountingStatus);
583582

584583
const rendererRootProps = {
585584
...(shouldShowFallback && fallback && { style: { display: 'none' } }),

packages/react/src/utils/useWaitForComponentMount.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ const waitForElementChildren = createAwaitableMutationObserver({
6565
isReady: (el, selector) => !!el?.childElementCount && el?.matches?.(selector) && el.childElementCount > 0,
6666
});
6767

68-
// const waitForElementAttribute = createAwaitableMutationObserver({
69-
// attributes: true,
70-
// // childList: true,
71-
// // subtree: true,
72-
// isReady: (el: HTMLElement | null, selector: string) => {
73-
// return el?.matches?.(selector) ?? false;
74-
// },
75-
// });
76-
7768
/**
7869
* Detect when a Clerk component has mounted by watching DOM updates to an element with a `data-clerk-component="${component}"` property.
7970
*/
@@ -90,21 +81,18 @@ export function useWaitForComponentMount(
9081
}
9182

9283
if (typeof window !== 'undefined' && !watcherRef.current) {
93-
const selector = `[data-clerk-component="${component}"]`;
94-
const attributeSelector = options?.selector;
95-
console.log('attributeSelector', attributeSelector, attributeSelector + selector);
84+
const defaultSelector = `[data-clerk-component="${component}"]`;
85+
const selector = options?.selector;
9686
watcherRef.current = waitForElementChildren({
97-
selector: attributeSelector ? attributeSelector + selector : selector,
87+
selector: selector
88+
? // Allows for `[data-clerk-component="xxxx"][data-some-attribute="123"] .my-class`
89+
defaultSelector + selector
90+
: defaultSelector,
9891
})
99-
// .then(res => {
100-
// return attributeSelector ? waitForElementAttribute({ selector: attributeSelector + selector }) : res;
101-
// })
10292
.then(() => {
103-
console.log('rendered', component);
10493
setStatus('rendered');
10594
})
10695
.catch(() => {
107-
console.log('error', component);
10896
setStatus('error');
10997
});
11098
}

0 commit comments

Comments
 (0)