These are chat archives for canjs/canjs

24th
Mar 2017
Szabolcs Schmidt
@sszabolcs
Mar 24 2017 10:56

Hi!

I've run into a weird module loading problem.
I have a 2.x can.Model with a typed - another 2.x can.Model - array attribute, defined using can-map-define.
I've noticed that the array attribute does not get "typed" (not array of other can.Model instances) at random intervals.
Let's say from 10 reload it does not get "typed" in 1 or 2 cases.
I've finally hunt it down.
If can-list.js's type() overload loads first and then can-map-define.js's type() overload then everything works fine.
But with opposite loading order can-list.js's type() function is called (not can-map-define.js's type() function) in can-map.js _set() which gives fault results.
I'm using requirejs with AMD CanJS 3 modules.
As a workaround I modified can-map-define.js and require can-list to ensure the right order.
What do you think about this solution? I could live with this workaround but I'm scared a bit because I don't know how many similar situations there are.

Kevin Phillips
@phillipskevin
Mar 24 2017 13:03
we actually have an issue open for that: canjs/can-list#33
I think that workaround is good for now
Szabolcs Schmidt
@sszabolcs
Mar 24 2017 14:02
@phillipskevin ok, thanks! What do you think could there be other similar cases?
Kevin Phillips
@phillipskevin
Mar 24 2017 14:04
I can’t really say for sure
rereading your problem, are you using can 2.3 can.Map and can-list?
or are you using can.List from 2.3?
Szabolcs Schmidt
@sszabolcs
Mar 24 2017 14:05
I'm actually using can/legacy which import can-list as I know
I'm not using can-list directly
Kevin Phillips
@phillipskevin
Mar 24 2017 14:06
oh, so you’re using can 3.0
Szabolcs Schmidt
@sszabolcs
Mar 24 2017 14:06
yes
I'm migrating to 3.0 to be more precise
Kevin Phillips
@phillipskevin
Mar 24 2017 14:36
ok
got it now