Skip to content

Commit

Permalink
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/smithy/src/stories/Tour/Tour.stories.tsx
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ export const Default = {
);

setForceRender(Math.random());
}, 333);
}, 1000);
}, []);

return (
2 changes: 0 additions & 2 deletions packages/react/src/components/Hint/useFloatingHint.ts
Original file line number Diff line number Diff line change
@@ -106,8 +106,6 @@ export function useFloatingHint({
useEffect(() => {
if (anchorElement != null) {
refs.setReference(anchorElement)
} else {
console.debug(`[frigade] Hint: No anchor found for selector: ${anchor}`)
}
}, [anchor, anchorElement, refs])

7 changes: 6 additions & 1 deletion packages/react/src/components/Hint/useMutationAwareAnchor.ts
Original file line number Diff line number Diff line change
@@ -32,10 +32,13 @@ export function useMutationAwareAnchor(anchor: string) {
const element = document.querySelector(anchor)

if (element != null) {
console.debug(`[frigade] Found anchor: ${anchor}`)
setAnchorElement(element)
} else {
console.debug(`[frigade] No anchor found for selector: ${anchor}`)
}
} catch (invalidSelector) {
/* no-op */
console.debug(`[frigade] Invalid selector for anchor: ${anchor}`)
}
}, [anchor])

@@ -54,6 +57,7 @@ export function useMutationAwareAnchor(anchor: string) {
const maybeAnchor = checkElementForAnchor(node as Element, anchor)

if (maybeAnchor != null) {
console.debug(`[frigade] Found anchor: ${anchor}`)
setAnchorElement(maybeAnchor)
break
}
@@ -67,6 +71,7 @@ export function useMutationAwareAnchor(anchor: string) {
const maybeAnchor = checkElementForAnchor(node as Element, anchor)

if (maybeAnchor != null) {
console.debug(`[frigade] Removed anchor: ${anchor}`)
setAnchorElement(null)
break
}

0 comments on commit 5d9deef

Please sign in to comment.