Skip to content

Commit

Permalink
destroy nodes, not explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-courtis committed Sep 23, 2024
1 parent b3df650 commit 9499017
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 0 additions & 12 deletions lua/nvim-tree/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@ function Explorer:expand(node)
self:_load(node)
end

function Explorer:destroy()
local function iterate(node)
node:destroy()
if node.nodes then
for _, child in pairs(node.nodes) do
iterate(child)
end
end
end
iterate(self)
end

---@param node Node
---@param git_status table|nil
function Explorer:reload(node, git_status)
Expand Down
9 changes: 9 additions & 0 deletions lua/nvim-tree/node/directory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ function DirectoryNode:create(explorer, parent, absolute_path, name, fs_stat)
return o
end

function DirectoryNode:destroy()
BaseNode.destroy(self)
if self.nodes then
for _, node in pairs(self.nodes) do
node:destroy()
end
end
end

return DirectoryNode

0 comments on commit 9499017

Please sign in to comment.