mirror of
https://github.com/littensy/charm.git
synced 2026-10-23 05:46:27 +00:00
feat: add batch()
This commit is contained in:
parent
8a0d0977ca
commit
f0a7938703
13 changed files with 112 additions and 52 deletions
|
|
@ -2,8 +2,6 @@ local validate = require(script.Parent.validate)
|
|||
|
||||
local NONE = { __none = "__none" }
|
||||
|
||||
local warnings = {}
|
||||
|
||||
local function diff(prevState: { [any]: any }, nextState: { [any]: any })
|
||||
local patches = table.clone(nextState)
|
||||
|
||||
|
|
@ -20,20 +18,14 @@ local function diff(prevState: { [any]: any }, nextState: { [any]: any })
|
|||
end
|
||||
|
||||
if _G.__DEV__ then
|
||||
local success, result = pcall(function()
|
||||
for key, value in prevState do
|
||||
for key, value in prevState do
|
||||
validate(value, key)
|
||||
end
|
||||
|
||||
for key, value in nextState do
|
||||
if prevState[key] ~= value then
|
||||
validate(value, key)
|
||||
end
|
||||
for key, value in nextState do
|
||||
if prevState[key] ~= value then
|
||||
validate(value, key)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if not success and not warnings[result] then
|
||||
warnings[result] = true
|
||||
warn(result)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue