diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index df876ab..ec7c48e 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -7,7 +7,6 @@ import { ExplorerNode, FileNode, Options } from "./ExplorerNode" import { QuartzPluginData } from "../plugins/vfile" import { classNames } from "../util/lang" import { i18n } from "../i18n" -import { VNode } from "preact" // Options interface defined in `ExplorerNode` to avoid circular dependency const defaultOptions = { @@ -45,7 +44,6 @@ export default ((userOpts?: Partial) => { // memoized let fileTree: FileNode let jsonTree: string - let component: VNode let lastBuildId: string = "" function constructFileTree(allFiles: QuartzPluginData[]) { @@ -84,46 +82,44 @@ export default ((userOpts?: Partial) => { if (ctx.buildId !== lastBuildId) { lastBuildId = ctx.buildId constructFileTree(allFiles) - const tree = ExplorerNode({ node: fileTree, opts, fileData }) - component = ( -
- -
-
    - {tree} -
  • -
-
-
- ) } - return component + return ( +
+ +
+
    + +
  • +
+
+
+ ) } Explorer.css = explorerStyle diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx index 3137a3f..e57d677 100644 --- a/quartz/components/ExplorerNode.tsx +++ b/quartz/components/ExplorerNode.tsx @@ -224,10 +224,15 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro class="content" data-folderul={folderPath} > - {node.children.map((childNode) => - // eagerly render children so we can memoize properly - ExplorerNode({ node: childNode, opts, fileData, fullPath: folderPath }), - )} + {node.children.map((childNode, i) => ( + + ))}