Skip to content

Commit

Permalink
Clarify the reason why we need to deepcopy cached children
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue committed Aug 26, 2023
1 parent 9e491f6 commit f6733bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autoload/fern/internal/node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ function! fern#internal#node#children(node, provider, token, ...) abort
if a:node.status is# s:STATUS_NONE
return s:Promise.reject('leaf node does not have children')
elseif has_key(a:node.concealed, '__cache_children') && options.cache
" Return a fresh copy of cached children so that status won't be cached
return s:AsyncLambda.map(
\ a:node.concealed.__cache_children,
\ { v -> extend(v, { 'status': v.status > 0 }) },
\ { v -> deepcopy(v) },
\)
elseif has_key(a:node.concealed, '__promise_children')
return a:node.concealed.__promise_children
Expand Down

0 comments on commit f6733bd

Please sign in to comment.