Skip to content

Commit

Permalink
feat(web): Add ?hideErrors query parameter to hide error toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
munshkr committed Jan 19, 2024
1 parent efa6de4 commit a90b481
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion packages/web/src/routes/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof _toast>[0]) => {
if (hideErrors) return;
_toast(options);
},
[_toast, hideErrors]
);

const postMessageParentWindow = (message: any) => {
window.parent.postMessage(message, "*");
Expand Down

0 comments on commit a90b481

Please sign in to comment.