Skip to content

Commit 7b46a16

Browse files
committed
destroy nodes, not explorer
1 parent 65e36cb commit 7b46a16

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

lua/nvim-tree/explorer/init.lua

-12
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,6 @@ function Explorer:expand(node)
7575
self:_load(node)
7676
end
7777

78-
function Explorer:destroy()
79-
local function iterate(node)
80-
node:destroy()
81-
if node.nodes then
82-
for _, child in pairs(node.nodes) do
83-
iterate(child)
84-
end
85-
end
86-
end
87-
iterate(self)
88-
end
89-
9078
---@param node Node
9179
---@param git_status table|nil
9280
function Explorer:reload(node, git_status)

lua/nvim-tree/node/directory.lua

+9
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,13 @@ function DirectoryNode:create(explorer, parent, absolute_path, name, fs_stat)
4949
return o
5050
end
5151

52+
function DirectoryNode:destroy()
53+
BaseNode.destroy(self)
54+
if self.nodes then
55+
for _, node in pairs(self.nodes) do
56+
node:destroy()
57+
end
58+
end
59+
end
60+
5261
return DirectoryNode

0 commit comments

Comments
 (0)