mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 11:44:08 +00:00
fix: refine reactive proxy logic
This commit is contained in:
parent
b3a76face9
commit
b826401bf3
6 changed files with 145 additions and 102 deletions
|
|
@ -49,12 +49,13 @@ local function signalToAtom<T>(getter: () -> T, setter: (value: ((T) -> T) | T)
|
|||
end
|
||||
|
||||
--[[
|
||||
Returns a deep copy of the given table.
|
||||
Returns a deep copy of the given table. Skips tables with metatables to
|
||||
prevent copying reactive proxies.
|
||||
]]
|
||||
local function deepCopy<T>(object: T): T
|
||||
local copy: any = table.clone(object :: any)
|
||||
for key, value in copy do
|
||||
if type(value) == "table" then
|
||||
if type(value) == "table" and getmetatable(value) == nil then
|
||||
copy[key] = deepCopy(value)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue