perf: eagerly compute explorer nodes to avoid re-render in memoized value

This commit is contained in:
Jacky Zhao 2024-09-15 18:05:02 -07:00
parent b1c60b8833
commit 16a9caa555
2 changed files with 44 additions and 45 deletions
quartz/components

View file

@ -224,15 +224,10 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro
class="content"
data-folderul={folderPath}
>
{node.children.map((childNode, i) => (
<ExplorerNode
node={childNode}
key={i}
opts={opts}
fullPath={folderPath}
fileData={fileData}
/>
))}
{node.children.map((childNode) =>
// eagerly render children so we can memoize properly
ExplorerNode({ node: childNode, opts, fileData, fullPath: folderPath }),
)}
</ul>
</div>
</li>