mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-17 13:22:29 +00:00
perf: eagerly compute explorer nodes to avoid re-render in memoized value
This commit is contained in:
parent
b1c60b8833
commit
16a9caa555
2 changed files with 44 additions and 45 deletions
quartz/components
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue