diff options
Diffstat (limited to 'acf/transaction/init.lua')
-rw-r--r-- | acf/transaction/init.lua | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/acf/transaction/init.lua b/acf/transaction/init.lua index 99b8b9d..eb92c34 100644 --- a/acf/transaction/init.lua +++ b/acf/transaction/init.lua @@ -123,7 +123,9 @@ function Transaction:commit() self:check() local errors = ErrorDict() - for path, func in pairs(self.validate) do errors:collect(func) end + for path, func in pairs(self.validate) do + if not self.deleted[path] then errors:collect(func) end + end errors:raise() local mods = {} @@ -147,15 +149,17 @@ function Transaction:commit() end local function insert_del(path) - local value = self.backend:get(path) - if type(value) == 'table' then - for _, child in ipairs(value) do - local cp = pth.join(path, child) - assert(self.deleted[cp]) - if not handled[cp] then insert_del(cp) end + if not handled[path] then + local value = self.backend:get(path) + if type(value) == 'table' then + for _, child in ipairs(value) do + local cp = pth.join(path, child) + assert(self.deleted[cp]) + insert_del(cp) + end end + insert(path) end - insert(path) end for path, deleted in pairs(self.deleted) do |