Skip to content

Commit 08a0aa1

Browse files
committed
Revert "fix(#1961): cycle detection on refresh, preventing infinite loop (#1996)"
This reverts commit 4222bb8.
1 parent 4222bb8 commit 08a0aa1

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lua/nvim-tree/explorer/reload.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ function M.refresh_nodes_for_path(path)
166166

167167
local profile = log.profile_start("refresh_nodes_for_path %s", path)
168168

169-
-- avoids cycles
170-
local paths_refreshed = {}
171-
172169
NodeIterator.builder({ explorer })
173170
:hidden()
174171
:recursor(function(node)
@@ -180,13 +177,10 @@ function M.refresh_nodes_for_path(path)
180177
end
181178
end)
182179
:applier(function(node)
183-
local abs_contains = node.absolute_path and path:find(node.absolute_path, 1, true) ~= 1
184-
local link_contains = node.link_to and path:find(node.link_to, 1, true) ~= 1
180+
local abs_contains = node.absolute_path and path:match("^" .. node.absolute_path)
181+
local link_contains = node.link_to and path:match("^" .. node.link_to)
185182
if abs_contains or link_contains then
186-
if not paths_refreshed[node.absolute_path] then
187-
paths_refreshed[node.absolute_path] = true
188-
M.refresh_node(node)
189-
end
183+
M.refresh_node(node)
190184
end
191185
end)
192186
:iterate()

0 commit comments

Comments
 (0)