From 492c90f9998bf7cc424d2edaa38972c0272caf85 Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Fri, 11 Oct 2024 08:50:10 +0300 Subject: [PATCH] add includeDependencies in listDiagrams (#270) --- src/context/storage-context/storage-provider.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/context/storage-context/storage-provider.tsx b/src/context/storage-context/storage-provider.tsx index 6439bbff..136201e6 100644 --- a/src/context/storage-context/storage-provider.tsx +++ b/src/context/storage-context/storage-provider.tsx @@ -190,7 +190,12 @@ export const StorageProvider: React.FC = ({ options: { includeTables?: boolean; includeRelationships?: boolean; - } = { includeRelationships: false, includeTables: false } + includeDependencies?: boolean; + } = { + includeRelationships: false, + includeTables: false, + includeDependencies: false, + } ): Promise => { let diagrams = await db.diagrams.toArray(); @@ -212,6 +217,15 @@ export const StorageProvider: React.FC = ({ ); } + if (options.includeDependencies) { + diagrams = await Promise.all( + diagrams.map(async (diagram) => { + diagram.dependencies = await listDependencies(diagram.id); + return diagram; + }) + ); + } + return diagrams; };