diff --git a/README.md b/README.md index 5fcc88d4..b3f1833a 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,7 @@ packages: its own evaluation mechanism. This still sends messages to parent window. Options: `*`, `[webTarget]`. Eg: `?noWebEval=hydra` disables only Hydra. `?noWebEval=*` disables all web targets. +* `hideErrors` (boolean): Do not show errors for web targets (hydra, strudel, etc) ### Window messages diff --git a/packages/web/src/routes/session.tsx b/packages/web/src/routes/session.tsx index 665561a5..b487a7ca 100644 --- a/packages/web/src/routes/session.tsx +++ b/packages/web/src/routes/session.tsx @@ -79,7 +79,17 @@ export default function SessionPage() { const hasWebGl = useMemo(() => isWebglSupported(), []); - const { toast } = useToast(); + const { toast: _toast } = useToast(); + const hideErrors = !!query.get("hideErrors"); + + // Only call toast if query parameter "hideErrors" is not present + const toast = useCallback( + (options: Parameters[0]) => { + if (hideErrors) return; + _toast(options); + }, + [_toast, hideErrors] + ); const postMessageParentWindow = (message: any) => { window.parent.postMessage(message, "*");