File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
packages/frontend/src/components/ApolloProvider Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,21 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => {
1313
1414 const onError = React . useCallback (
1515 ( message : string ) => {
16- toast ( {
17- title : message ,
18- description :
19- 'If this error persists, contact us at [email protected] .' , 20- status : 'error' ,
21- duration : 3000 ,
22- isClosable : true ,
23- position : 'top' ,
24- } )
16+ // HACKFIX: we use this toast.isActive to prevent duplicate toasts from being shown.
17+ // there should be a better way to handle this from the ApolloClient.
18+ const id = `graphql-error-${ message . slice ( 0 , 15 ) } `
19+ if ( ! toast . isActive ( id ) ) {
20+ toast ( {
21+ id,
22+ title : message ,
23+ description :
24+ 'If this error persists, contact us at [email protected] .' , 25+ status : 'error' ,
26+ duration : 3000 ,
27+ isClosable : true ,
28+ position : 'top' ,
29+ } )
30+ }
2531 } ,
2632 [ toast ] ,
2733 )
You can’t perform that action at this time.
0 commit comments