Skip to content

Commit

Permalink
Merge pull request #242 from munshkr/feat/hide-notifications-query-param
Browse files Browse the repository at this point in the history
feat(web): Add `?hideErrors` query parameter to hide error toasts
  • Loading branch information
munshkr authored Jan 19, 2024
2 parents efa6de4 + a90b481 commit 08b5e46
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 08b5e46

Please sign in to comment.