@@ -17,6 +17,7 @@ import { AdminPageHeader } from "./AdminPageHeader";
1717import Pagination from "../Pagination/Pagination" ;
1818import { Button } from "@podkit/buttons/Button" ;
1919import { installationClient } from "../service/public-api" ;
20+ import { ListBlockedEmailDomainsResponse } from "@gitpod/public-api/lib/gitpod/v1/installation_pb" ;
2021
2122export function BlockedEmailDomains ( ) {
2223 return (
@@ -39,20 +40,19 @@ function useUpdateBlockedEmailDomainMutation() {
3940 async ( blockedDomain : EmailDomainFilterEntry ) => {
4041 await installationClient . createBlockedEmailDomain ( {
4142 domain : blockedDomain . domain ,
42- negative : blockedDomain . negative ,
43+ negative : blockedDomain . negative ?? false ,
4344 } ) ;
4445 } ,
4546 {
4647 onSuccess : ( _ , blockedDomain ) => {
47- const updated = [ ] ;
48- for ( const entry of blockedEmailDomains . data ? .blockedEmailDomains || [ ] ) {
48+ const data = new ListBlockedEmailDomainsResponse ( blockedEmailDomains . data ) ;
49+ data . blockedEmailDomains . map ( ( entry ) => {
4950 if ( entry . domain !== blockedDomain . domain ) {
50- updated . push ( entry ) ;
51- } else {
52- updated . push ( blockedDomain ) ;
51+ return entry ;
5352 }
54- }
55- queryClient . setQueryData ( [ "blockedEmailDomains" ] , updated ) ;
53+ return blockedDomain ;
54+ } ) ;
55+ queryClient . setQueryData ( [ "blockedEmailDomains" ] , data ) ;
5656 blockedEmailDomains . refetch ( ) ;
5757 } ,
5858 } ,
0 commit comments