These are chat archives for ractivejs/ractive

21st
Jun 2017
Bob Schellink
@sabob
Jun 21 2017 09:06
Thank for link to VSCode. Didn't know about it. Good node debugger as well!
Joseph
@fskreuz
Jun 21 2017 12:04
Haven't used the debugger, especially when Node has --inspect and --inspect-brk that debugs code in Chrome dev tools.
Matt Granmoe
@granmoe
Jun 21 2017 20:20
So, ractive.set is not giving me the result I expect. Using it like so:
this.set("form", formUpdates, {deep: true});
Where form before update is a big object, and formUpdates is an object with only some of the keys of form and some new values. After set, this.get('form') only has the contents of formUpdates. Shouldn't it merge the two? If not, is there a way to do that?
Joseph
@fskreuz
Jun 21 2017 20:24
Seems to work as expected here. Can you provide a reproduction?
Matt Granmoe
@granmoe
Jun 21 2017 20:26
yeah, let me see if I can modify your example to be like mine
Matt Granmoe
@granmoe
Jun 21 2017 20:41
that's weird, can't get it to happen in the ractive playground
it's happening for me in 0.8.14. Maybe a version thing?
Chris Reeves
@evs-chris
Jun 21 2017 20:42
yep, deep was added in 0.9 :smile:
Joseph
@fskreuz
Jun 21 2017 20:42
:tada:
Matt Granmoe
@granmoe
Jun 21 2017 20:43
ah shit
:)
any way to mimic it in 0.8?
ractive.merge?
Chris Reeves
@evs-chris
Jun 21 2017 20:43
merge only shuffles arrays, unfortunately
Matt Granmoe
@granmoe
Jun 21 2017 20:44
maybe I'll just use Object.assign to merge the two object then set the result
Chris Reeves
@evs-chris
Jun 21 2017 20:44
yeah
if you have lodash or something like it available, you could get, lodash merge, and then update
Joseph
@fskreuz
Jun 21 2017 20:44
Object.assign isn't recursive, yes?
Yep, iirc, lodash has recursive merge.
Matt Granmoe
@granmoe
Jun 21 2017 20:45
it doesn't clone deep values, it keeps the references if that's what you mean
Matt Granmoe
@granmoe
Jun 21 2017 22:05
ended up using lodash clonedeep