These are chat archives for canjs/canjs

26th
Jan 2018
Runn Vermel
@runn-vermel
Jan 26 2018 16:41
Hi @phillipskevin - i wish i could, but sadly, i can't. it's this function:
This message was deleted
`` map.each(function (val, name) { // If the value is anobject, and has anattrorserialize` function.
            var result,
                isObservable =   hasMethod(val, how),
                serialized = isObservable && serializeMap[how][CID(val)];

            if( serialized ) {
                result = serialized;
            } else {
                // special attr or serializer
                result = defineHelpers.getValue(map, name, val, how);
            }
            // this is probably removable
            if(result !== undefined) {
                where[name] = result;
            }


        });```
inside the serialize method on that page
Kevin Phillips
@phillipskevin
Jan 26 2018 16:44
ok, are you on an older version of can-define?
looks like that code was refactored recently
Runn Vermel
@runn-vermel
Jan 26 2018 16:44
let me check what i got.
i'm on 1.2.0
looks like the latest one is 1.5.3
Kevin Phillips
@phillipskevin
Jan 26 2018 16:47
any reason you can't update?
Runn Vermel
@runn-vermel
Jan 26 2018 16:48
but... i have to admit, i'm super scared to update anything fromthe canJs packages. trouble seems to follow doing that. ha.
i'll do it locally now and see if fixes it, or causes anything else..
Kevin Phillips
@phillipskevin
Jan 26 2018 16:49
never want to hear that, hope it goes ok
Runn Vermel
@runn-vermel
Jan 26 2018 16:50
thanks. i don't mean to be offensive (at all), and i really appreciate all your help with this.
i'm running into all these issues because after not touching the app in production for a while, we had to do an update, which pulled in new packages - we had ^ in our canJS packages. and... now we have these issues.
Kevin Phillips
@phillipskevin
Jan 26 2018 16:51
yeah, no offense taken
Runn Vermel
@runn-vermel
Jan 26 2018 17:19
@phillipskevin - ok, i updated and locally it looks good. it's on our staging server, and seems to be running better, so let's hope that was it :) thanks again!!
Kevin Phillips
@phillipskevin
Jan 26 2018 17:19
yep, no problem
RyanMilligan
@RyanMilligan
Jan 26 2018 20:28
We have kind of an unusual scenario for updating lists that real-time doesn't seem to handle properly. We worked around it in the past by forking can-connect and fixing the issue, but now that we're on Can 3 we're hoping to move away from that.
Basically, we have a number of pages where we display a join of two (or more) tables, where each row represents a combination of those joined tables and may or may not be backed by an actual database row; the middle tier returns all possible combinations, and the ones that don't exist have a null id.
This works fine in general, but when the user deletes a row, everything goes haywire. The middle tier returns {id: null} in the payload, the original object's id gets nulled out...but then in real-time.js, indexOf(self, props, list) returns whatever happens to be the first index in the list that doesn't have an id, and it overwrites the wrong object. The end result is that an essentially random row disappears and the row they deleted gets duplicated.
RyanMilligan
@RyanMilligan
Jan 26 2018 23:41
We've made a new fork off of the version of can-connect we're using and brought our fix over. I plan to clean it up a little bit and submit it as a pull request.
Frank Lemanschik
@frank-dspeed
Jan 26 2018 23:43
@RyanMilligan you should wait some weeks
also you should take the survey about new futures
because canJs 4 will come out in the next weeks
and after that a new can-connect is planned if it gets enough votes
so you can reduce your effort with simply waiting
RyanMilligan
@RyanMilligan
Jan 26 2018 23:44
Gotcha. We've spent about two months migrating from 2 to 3, so I think migrating to 4 any time soon will be a very tough sell. I'd be happy to take the survey, though.
Frank Lemanschik
@frank-dspeed
Jan 26 2018 23:45
yes there are codemods
for that cases
migrating 3 -> 4 is not much work
if your v3 is in shape and running
i have just upgraded a big project to can4 it works well
RyanMilligan
@RyanMilligan
Jan 26 2018 23:49
We can try that. We didn't have much luck with 2 -> 3 and wound up doing most of it manually, but maybe 3 -> 4 is an easier migration.