Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

fix: handle failsafe for toast element mounting (#127)

sayan-truefoundryac4c88f9e13b
diff --git a/packages/trueforge-ui-sdk/src/atoms/Toast.tsx b/packages/trueforge-ui-sdk/src/atoms/Toast.tsx
index eee97f35c..62ea1ac4f 100644
--- a/packages/trueforge-ui-sdk/src/atoms/Toast.tsx
+++ b/packages/trueforge-ui-sdk/src/atoms/Toast.tsx
@@ -80,9 +80,14 @@ export type ToastStackProps = {
};
const openToastStack = (element: HTMLDivElement | null): void => {
- if (element === null || typeof element.showPopover !== 'function') return;
- if (element.matches(':popover-open')) element.hidePopover();
- element.showPopover();
+ if (element === null) return;
+ try {
+ if (typeof element.showPopover !== 'function') return;
+ if (element.matches(':popover-open')) element.hidePopover();
+ element.showPopover();
+ } catch {
+ // Popover APIs can reject during attachment; the fixed stack remains usable.
+ }
};
export function ToastStack({ children, duration: _duration = Number.POSITIVE_INFINITY }: ToastStackProps) {