File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed
compass-app-stores/src/stores Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,7 @@ export function createInstancesStore(
554554 ) ;
555555
556556 on ( globalAppRegistry , 'document-deleted' , refreshNamespaceStats ) ;
557+ on ( globalAppRegistry , 'documents-deleted' , refreshNamespaceStats ) ;
557558 on ( globalAppRegistry , 'document-inserted' , refreshNamespaceStats ) ;
558559 on ( globalAppRegistry , 'import-finished' , refreshNamespaceStats ) ;
559560
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ application can be listened to via [compass-app-registry][compass-app-registry].
101101 ` insertMany ` and ` insertOne ` complete.
102102- ** 'document-updated'** : indicates a document was updated.
103103- ** 'document-deleted'** : indicates a document was deleted.
104+ - ** 'documents-deleted'** : indicates multiple documents were deleted.
104105
105106#### Local
106107
@@ -110,6 +111,7 @@ application can be listened to via [compass-app-registry][compass-app-registry].
110111 ` insertMany ` and ` insertOne ` complete.
111112- ** 'document-updated'** : indicates a document was updated.
112113- ** 'document-deleted'** : indicates a document was deleted.
114+ - ** 'documents-deleted'** : indicates multiple documents were deleted.
113115
114116### App Registry Events Received
115117
@@ -135,6 +137,7 @@ application can be listened to via [compass-app-registry][compass-app-registry].
135137- ** document-inserted**
136138- ** document-updated**
137139- ** document-deleted**
140+ - ** documents-deleted**
138141
139142## Development
140143
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ export type EmittedAppRegistryEvents =
7878 | 'open-import'
7979 | 'open-export'
8080 | 'document-deleted'
81+ | 'documents-deleted' //Added new type for handling bulk deletion
8182 | 'document-inserted' ;
8283
8384export type CrudActions = {
@@ -1977,6 +1978,10 @@ class CrudStoreImpl
19771978 try {
19781979 await this . dataService . deleteMany ( this . state . ns , filter ) ;
19791980 this . bulkDeleteSuccess ( ) ;
1981+ // Emit both events so all listeners update (fixes bulk delete document count not updating)
1982+ const payload = { view : this . state . view , ns : this . state . ns } ;
1983+ this . localAppRegistry . emit ( 'documents-deleted' , payload ) ;
1984+ this . connectionScopedAppRegistry . emit ( 'documents-deleted' , payload ) ;
19801985 } catch ( ex ) {
19811986 this . bulkDeleteFailed ( ex as Error ) ;
19821987 }
You can’t perform that action at this time.
0 commit comments