mergeObject
mergeObject
is a beast of a function which lets you smash two objects together and that options argument lets you control how exactly you want to merge things.
Argument 1: Source Object --> What we are merging into (this is going to be mutated by default)
Argument 2: Mod Object --> What we are applying to the Source
insertKeys [true]
-> If the Mod Object has keys in it which the Source does not have, add those keys to the Source object.
insertValues [true]
-> If the Source Object's values are objects themselves, this controls whether to merge those values as part of this operation (kind of discount recursive
)
So for your case:
Where defaultValues
is the setting's default, and the clientSettingsValues
is the current setting value.
This would take the baseline default value and overwrite any existing key/value, but not merge value objects (instead, it would replace them). It'll overwrite because the overwrite
option is true by default.38 Replies
@mouse0270 what are you up to that isn't workin?
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
aye
First one is
defaultValues
Second one is clientSettingsValues
?Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
so far this is my understanding as well
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
let me guess, you're seeing
square-corners
in theme
balls
try adding: recursive: false
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
ok, we're going off the rails here, can you remove the
--
from the start of each key?Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
ok good (bad but not super bad)
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
wuuuut
You've just hit "escalate to #dev-support on the mothership" territory
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
One more thing to try, clone the object first, then don't do
inplace: false
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
(hollering about that, which module did you release under your name again?)
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
đź‘Ť
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
something's real off
because if this doesn't work, that's got some big implications
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
norc hooked you up with the right role
you should be able to post now
@mouse0270 I'd suggest using a minimal reproduction case to keep that channel clean 🙂
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
awesome
thanks @mouse0270
Sorry I couldn't get you sorted. I'm hoping this is something stupid we're both missing.
@calego gave LeaguePoints™ to @mouse0270 (#40 • 43)
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
that only activates if
recursive: true
though
(or should)Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
what in tarnation
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
you could try putting a breakpoint on it and step through to see where it's going wrong
in a meeting but I'll see if I can after
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
I understand you now, ugh
where's that
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Don't libwrap mergeObject, better to DIY it or work around.
There's the off chance that something is relying on this behavior and mergeObject is so prolific in the foundry core that patching it is likely to cause gods knows what issues
if this is a bug, that sucks
But, right now is the perfect time to find it, as it can get fixed in V9 prototype phase
I remember running into this when making the Typescrpt type prototype for mergeObject
I wasn't sure if it was intentional then
still am not
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View