File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
packages/compass-data-modeling/src/components Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,18 @@ const DiagramListEmptyContent: React.FunctionComponent<{
181181 ) ;
182182} ;
183183
184+ const getDatabase = (
185+ modelDescription : MongoDBDataModelDescription
186+ ) : string [ ] => {
187+ try {
188+ return selectCurrentModel ( modelDescription . edits ) . collections . map (
189+ ( { ns } ) => toNS ( ns ) . database
190+ ) ;
191+ } catch {
192+ return [ ] ;
193+ }
194+ } ;
195+
184196export const SavedDiagramsList : React . FunctionComponent < {
185197 onCreateDiagramClick : ( ) => void ;
186198 onOpenDiagramClick : ( diagram : MongoDBDataModelDescription ) => void ;
@@ -201,11 +213,7 @@ export const SavedDiagramsList: React.FunctionComponent<{
201213 } ) [ ]
202214 > ( ( ) => {
203215 return items . map ( ( item ) => {
204- const databases = new Set (
205- selectCurrentModel ( item . edits ) . collections . map (
206- ( { ns } ) => toNS ( ns ) . database
207- )
208- ) ;
216+ const databases = new Set ( getDatabase ( item ) ) ;
209217 return {
210218 ...item ,
211219 databases : Array . from ( databases ) . join ( ', ' ) ,
You can’t perform that action at this time.
0 commit comments