chore: resolve undefined-field

This commit is contained in:
Alexander Courtis
2024-10-26 12:52:40 +11:00
parent 568d0f15ab
commit 3218d96114

View File

@@ -338,17 +338,19 @@ function M.refresh_dir(dir)
end) end)
end end
---@param n DirectoryNode ---@param dir DirectoryNode?
---@param projects table ---@param projects table
function M.reload_node_status(n, projects) function M.reload_node_status(dir, projects)
local toplevel = M.get_toplevel(n.absolute_path) dir = dir and dir:as(DirectoryNode)
local status = projects[toplevel] or {} if not dir or #dir.nodes == 0 then
for _, node in ipairs(n.nodes) do return
node:update_git_status(n:is_git_ignored(), status)
local dir = node:as(DirectoryNode)
if dir and #dir.nodes > 0 then
dir:reload_node_status(projects)
end end
local toplevel = M.get_toplevel(dir.absolute_path)
local status = projects[toplevel] or {}
for _, node in ipairs(dir.nodes) do
node:update_git_status(dir:is_git_ignored(), status)
M.reload_node_status(node:as(DirectoryNode), projects)
end end
end end