From fea352849c6972da4b3b8935eb2e86f6cefc76ed Mon Sep 17 00:00:00 2001
From: Ben Schlegel <ben5.schlegel@gmail.com>
Date: Sat, 16 Sep 2023 17:45:21 +0000
Subject: [PATCH] fix: create deep copy of file passed into tree

---
 quartz/components/Explorer.tsx |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx
index ee0f96f..23c5db2 100644
--- a/quartz/components/Explorer.tsx
+++ b/quartz/components/Explorer.tsx
@@ -35,6 +35,16 @@
     // Sort tree (folders first, then files (alphabetic))
     fileTree.sort(opts.sortFn!)
 
+    // If provided, apply filter function to fileTree
+    if (opts.filterFn) {
+      fileTree.filter(opts.filterFn)
+    }
+
+    // If provided, apply map function to fileTree
+    if (opts.mapFn) {
+      fileTree.map(opts.mapFn)
+    }
+
     // Get all folders of tree. Initialize with collapsed state
     const folders = fileTree.getFolderPaths(opts.folderDefaultState === "collapsed")
 

--
Gitblit v1.10.0