@@ -27,6 +27,7 @@ interface Props {
2727 className ?: string ;
2828 typeName : string ;
2929 selectedIds : Set < string > ;
30+ onDelete : ( ) => void ;
3031}
3132
3233const ErroredDocuments = ( { e, schemaType } : { e : any ; schemaType : any } ) => {
@@ -61,7 +62,12 @@ const ErroredDocuments = ({ e, schemaType }: { e: any; schemaType: any }) => {
6162const removeDraftPrefix = ( s : string ) =>
6263 s . startsWith ( 'drafts.' ) ? s . substring ( 'drafts.' . length ) : s ;
6364
64- function BulkActionsMenu ( { className, selectedIds, typeName } : Props ) {
65+ function BulkActionsMenu ( {
66+ className,
67+ selectedIds,
68+ typeName,
69+ onDelete,
70+ } : Props ) {
6571 const buttonId = useMemo ( nanoid , [ ] ) ;
6672 const schemaType = useMemo ( ( ) => schema . get ( typeName ) , [ typeName ] ) ;
6773 const toast = useToast ( ) ;
@@ -88,7 +94,7 @@ function BulkActionsMenu({ className, selectedIds, typeName }: Props) {
8894
8995 const draftIdsThatAlsoHavePublishedIds = ids . filter (
9096 ( id ) =>
91- id . startsWith ( 'drafts.' ) && idSet . has ( id . substring ( 'drafts.' . length ) ) ,
97+ id . startsWith ( 'drafts.' ) && idSet . has ( id . substring ( 'drafts.' . length ) )
9298 ) ;
9399
94100 const t = client . transaction ( ) ;
@@ -225,6 +231,7 @@ function BulkActionsMenu({ className, selectedIds, typeName }: Props) {
225231 }
226232
227233 await t . commit ( ) ;
234+ onDelete ( ) ;
228235 } catch ( e ) {
229236 console . warn ( e ) ;
230237
@@ -234,8 +241,7 @@ function BulkActionsMenu({ className, selectedIds, typeName }: Props) {
234241 < >
235242 < p >
236243 The bulk delete failed. This usually occurs because there are
237- other documents referencing the documents you’re trying to
238- delete.
244+ other documents referencing the documents you’re trying to delete.
239245 </ p >
240246
241247 < ErroredDocuments e = { e } schemaType = { schemaType } />
0 commit comments