These are chat archives for canjs/canjs

20th
Oct 2017
Frank Lemanschik
@frank-dspeed
Oct 20 2017 07:40
@Xitstrategies i can claim knowleg of 80% active code over all modules
:D
no that issue does not exist can zone never swallows errors
but there is a known bug with nested setTimeout Functions
that for example blocks socket.io from working correctly with zones
if you want to know more about the logging in canJS
that is a t present part of can-util/dev/dev
that is depricated and now
can-log/dev/dev :)
but to make it more short done-autorender which uses zones has a option called no-zone
which bypasses zones complet :)
Gregg Roemhildt
@roemhildtg
Oct 20 2017 13:47
@bmomberger-bitovi So I'm working on this can symbol observability stuff again today, and I'm back at a point where I'm not sure what's wrong. I've found out that the watch function doesn't always work, when working with nested objects, so to workaround that, I've modified my function to use .watch('center.longitude'...) which does work. The template renders the initial value, but the template still isn't getting updated when the values change. My onKeyValue handler is getting called. But my getKeyValue is not getting called after that which is where I believe the problem lies.
Kevin Phillips
@phillipskevin
Oct 20 2017 13:51
I haven't really been following what you're trying to do, but from looking at that code it looks like your onKeyValue doesn't actually call your handlers
Gregg Roemhildt
@roemhildtg
Oct 20 2017 13:54
Line 42, I think it does, unless I'm missing something.
Kevin Phillips
@phillipskevin
Oct 20 2017 13:55
but that's just when the watch is triggered, right?
sorry, maybe that makes sense
so you're saying onKeyValue is called, then whatever triggers watch happens, and your handlers don't update the template?
Gregg Roemhildt
@roemhildtg
Oct 20 2017 13:56
Right
Kevin Phillips
@phillipskevin
Oct 20 2017 13:57
ok
getKeyValue shouldn't have to be called after that in order for it to work
Gregg Roemhildt
@roemhildtg
Oct 20 2017 14:10
I think I have it working pretty much like I have in my dev setup
Brad Momberger
@bmomberger-bitovi
Oct 20 2017 15:24
I think you might be doing too many handler dispatches. You make a watch for every onKeyValue, but each watch handler goes over the entire handlers list.
I don't know that this is the root of the live problem, but it couldn't hurt to clean that up.
Oh! I do see one thing that might be a problem with your @@can.getKeyValue. It's using can-util/js/get/get, which doesn't use canReflect.getKeyValue to access properties.
Brad Momberger
@bmomberger-bitovi
Oct 20 2017 15:33
If you want to read deep paths on an object, I would recommend trying can-stache-key.get instead.
Gregg Roemhildt
@roemhildtg
Oct 20 2017 16:29

You make a watch for every onKeyValue, but each watch handler goes over the entire handlers list.

I'm not following, shouldn't each watch handler call each handler that is listening for that key's changes?

Brad Momberger
@bmomberger-bitovi
Oct 20 2017 16:30
If you have two watches on one key, and that key changes, then two watches each call two handlers.
Gregg Roemhildt
@roemhildtg
Oct 20 2017 16:30
Ohh, I see
Yes that would happen
Gregg Roemhildt
@roemhildtg
Oct 20 2017 16:52
I'm not sure how to use can-stache-key, but what if I just add observation.add(obj, key) to the get function from can-util?
wouldn't that trigger the getKeyValue
Brad Momberger
@bmomberger-bitovi
Oct 20 2017 17:33
Yeah, if you want to just copy and modify the get function, that should work too