fix: fs and refresh bugs
- refreshing delete from entries before adding new entries to avoid conflicts with indexes - delete is synchronous because on large folders it was not recursing properly thus causing errors and not deleting content.
This commit is contained in:
@@ -104,6 +104,15 @@ function M.refresh_entries(entries, cwd)
|
||||
::continue::
|
||||
end
|
||||
|
||||
local idx = 1
|
||||
for _, name in ipairs(cached_entries) do
|
||||
if not new_entries[name] then
|
||||
table.remove(entries, idx, idx + 1)
|
||||
else
|
||||
idx = idx + 1
|
||||
end
|
||||
end
|
||||
|
||||
local all = {
|
||||
{ entries = dirs, fn = dir_new },
|
||||
{ entries = links, fn = link_new },
|
||||
@@ -127,15 +136,6 @@ function M.refresh_entries(entries, cwd)
|
||||
prev = name
|
||||
end
|
||||
end
|
||||
|
||||
local idx = 1
|
||||
for _, name in ipairs(cached_entries) do
|
||||
if not new_entries[name] then
|
||||
table.remove(entries, idx, idx + 1)
|
||||
else
|
||||
idx = idx + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.populate(entries, cwd)
|
||||
|
||||
Reference in New Issue
Block a user