These are chat archives for canjs/canjs

27th
Jul 2017
Frank Lemanschik
@frank-dspeed
Jul 27 2017 09:59
@matthewp Special question for you is there some way to detect if something got loaded inside steal as a packege?
ah forget it i think all packages will look same i am evaluating a way to switch components and apps
@phillipskevin about the guides and CTO's if we get this app component switching working
we could base guides on that so every component guide (Small APP)
can be combined into the big app that Sells to a CTO like me
:D
my main case to jump into this was for example the components idea (Plugins) reuseable code
but because of the diffrence between apps and components this idea got attacked a bit
and only for you personal info i found out about donejs via EJS :)
without the comment on the EJS documentations i would never had watched this
Frank Lemanschik
@frank-dspeed
Jul 27 2017 10:05
i was a heavy EJS user that saw this and tought ok as i am also doing mobile apps and that aims to be server side and also client side so isomorphic + components was the selling point as i expected i can build a components stack that i can combine how i like it
i found out a way to do that as i described earlyer here but it was really complicated to figure that out i needed really deep understanding to archiv that plugin component test app workflow
i think in general every new coder that reads the pages the first time without knowing the code expects that he can combine the stuff without recoding in any way like building blocks that are individual test able
Viktor Busko
@Lighttree
Jul 27 2017 11:01
Guys, is there any good practice regarding getting data from AppVm. For example AppVM contains data that required inside some components (for routing for example). But I don't want to set leakScope: true everywhere. Is there good approach to get something from "root scope" ?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 11:27
@Lighttree its called can-stache bindings
Viktor Busko
@Lighttree
Jul 27 2017 12:31
yeah but by this you can go only on 1 level to child or to parent isn't it ? And lets say I have root vm, then some component...like popup...and content of this component another component :) I'll have to pass the data for all nested components right ?
Is it ok ?
Gira Minus
@gKreator
Jul 27 2017 12:48
Yes
Frank Lemanschik
@frank-dspeed
Jul 27 2017 12:49
or you can do the easy way and tell the component to leakScope
:D
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:10
@frank-dspeed I was looking into loading components from different apps in separate project folders, and it sort of works, but I ran into an issue where I was in a file in project 1, trying to load project2/file/file and imports in that file had import stuff from '~/other/other which steal interpreted as being in project1 even though the file is in proejct2
I had set up steal's paths to use this: "project2/*": "/apps/project2/*.js"
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:15
good point thanks for reporting
i don't runned into that issue as the maximum stack where i am doing is
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:15
Is this expected, or should I create an issue?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:15
is a isolated component as app with some routes
hehehe
i think creating a issue is not really the right way as this usage is far out of the regular scope of this project at present
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:16
That sounds tricky
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:16
but i will put that as comment on my current issue where i am thinking about such stuff
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:16
I've run into a few infinite loops in can-js sometimes with chrome
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:16
i have a own need for stuff like that
where? what ?
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:17
sounds good
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:17
you should report that if you understand under infinity loop the same as me
:D
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:17
Just occasionally, nothing serious to report
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:17
ok
i think and hope i can come up till next week with a near final solution for this
i am evaluating at present 4 methods to get this working
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:20
:thumbsup: !
i'm looking forward to seeing what you get
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:21
yes i saw you already thumb +1 the issue
you will get all updates there
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:21
Yes, I think I subscribed
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:21
sorry that it will take some time but as you heard befor no one from the core team got that use case at present
and i was simply using my work around where every component is a single app with no dependencys like you got them now
you now got the case that your loading a component from a other app that depends on even other component from that app
i don't got that because i prevented from this by design but will think also about that
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:36
Oooh, I see what you mean. So each app is its own component, with no child components?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:36
right
each app is only one component and its sub components
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:37
Yeah my project is pretty complex with regards to dependencies, like I have a form components that get used throughout several other components
Frank Lemanschik
@frank-dspeed
Jul 27 2017 13:37
yes i know that case i have even more complex cases :)
i will get it solved
and will atlast come up with a good structure that addresses that
and later next week do a geneartor for such components
so i will call it maybe multi-component or such thing i keep you updated via the issue
Gregg Roemhildt
@roemhildtg
Jul 27 2017 13:39
okay awesome!
DaveO
@DaveO-Home
Jul 27 2017 17:33

Just tried canjs 3.9.0 - got the following (did a complete clean and full install)
jquery.js:3870 Uncaught Error: can-reflect: can not observe value change
at Object.eval [as onValue] (observe.js:24)
at Observation.addEdge (can-observation.js:197)
at Observation.updateBindings (can-observation.js:282)
at Observation.start (can-observation.js:269)
at Compute._on (proto-compute.js:151)
at Compute.eval (proto-compute.js:331)
at Compute.eval [as _eventSetup] (can-observation.js:591)
at Compute.prototype.addEventListener (lifecycle.js:30)
at Function.addEventListener (can-compute.js:49)
at Function._setup (can-route.js:828)
(anonymous) @ observe.js:24
addEdge @ can-observation.js:197
updateBindings @ can-observation.js:282
start @ can-observation.js:269
_on @ proto-compute.js:151
(anonymous) @ proto-compute.js:331
(anonymous) @ can-observation.js:591
prototype.addEventListener @ lifecycle.js:30
addEventListener @ can-compute.js:49
_setup @ can-route.js:828
ready @ can-route.js:615
(anonymous) @ router.js:55
mightThrow @ jquery.js:3584
process @ jquery.js:3652 

Frank Lemanschik
@frank-dspeed
Jul 27 2017 17:59
@DaveO-Home what nodejs version what npm version or yarn version
consider please to open a issue on the github.com/canjs/canjs repo
i never saw such a message befor
DaveO
@DaveO-Home
Jul 27 2017 18:01
Fedora 25 /npm 3.10.10 node 6.11.1
Kevin Phillips
@phillipskevin
Jul 27 2017 18:01
it's hard to tell what is causing that without having more information
DaveO
@DaveO-Home
Jul 27 2017 18:02
Here are my dependencies
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"can": "3.8.2",
"can-view-callbacks": "3.0.6",
"font-awesome": "^4.7.0",
"jquery": "^3.2.0",
"lodash": "^4.17.0",
"moment": "^2.18.1",
"pdfjs-dist": "^1.8.0",
"steal": "^1.5.0",
"steal-css": "^1.2.4",
"tablesorter": "^2.28.0",
"tether": "^1.4.0"
},
"devDependencies": {
"jasmine-core": "^2.6.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-steal-npm": "^0.1.5",
"karma-story-reporter": "^0.3.1",
"steal-tools": "^1.3.0"
},
Kevin Phillips
@phillipskevin
Jul 27 2017 18:02
you could put a breakpoint in can-compute.js:49 and see what the compute is
can 3.8.2?
must be 3.9.0
DaveO
@DaveO-Home
Jul 27 2017 18:03
Oh I just changed that to get back to my old env.
It seems that can-view-callbacks is a strange animal??
App now works with 3.8.2
DaveO
@DaveO-Home
Jul 27 2017 19:51
@phillipskevin - I'm using "can/map" as my modelView in the router. Is that Ok?
Note: I've commented out all of my listeners but still get the error.
Here's a snippet;
init: function () {
$(function () {
                    Route.ready(false);
                    var viewModel = new ApplViewModel();

                    Route.data = viewModel;

                    Route.on("change", function (ev, attr, how, newVal, oldVal) {

                        if (how === "set") {
                            Start.initMenu();
                        }

                    });

                    Route.on("id", function (ev, attr, oldVal) {

                        if (attr) {
                            this.dispatch();
                        }

                    });

                    Route.on("action", function (ev, attr, oldVal) {

                        if (attr) {
                            this.dispatch();
                        }

                    });

                    Route.on("home", function (ev, attr, oldVal) {

                        var data = {};

                        if (attr) {

                            this.index(data);

                        }

                    });

                    Route("{controller}/{action}/{id}");
                    Route("{controller}/{action}");
                    Route("", {home: "#!"});
                    Route.ready(true);
                });

                return Route;
            }
Kevin Phillips
@phillipskevin
Jul 27 2017 19:58
why are you passing true to route.ready?
DaveO
@DaveO-Home
Jul 27 2017 19:58
Is that wrong?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 19:59
yes the ready function is made to get called without arguments
but it will not have any errors i think as it simply don't get used in the ready function
Kevin Phillips
@phillipskevin
Jul 27 2017 19:59
I think if you pass true it doesn't do anything
it skips setting up routes
I'm not sure why it's like that to be honest
DaveO
@DaveO-Home
Jul 27 2017 20:00
I just tested with (), still fails
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:00
i know it
         * ## Use
         *
         * After setting all your routes, call can.route.ready().
         *
         *     can.route("overview/:dateStart-:dateEnd");
         *     can.route(":type/:id")
         *     can.route.ready()
         */
        ready: function (val) {
            if (val !== true) {
                can.route._setup();
                if(can.isBrowserWindow || can.isWebWorker) {
                    can.route.setState();
                }
            }
            return can.route;
        },
its for reseting the state
DaveO
@DaveO-Home
Jul 27 2017 20:03
Fixed!!!! I also had Route.read(false); removed this and using Route.ready() works. I think I had code from canjs 2.
Kevin Phillips
@phillipskevin
Jul 27 2017 20:03
with 3.9.0?
DaveO
@DaveO-Home
Jul 27 2017 20:04
Yes - the 3.9.0 now works...
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:04
oh right my code is from can 2.3 i hate this redicrects
DaveO
@DaveO-Home
Jul 27 2017 20:04
Thanks
Kevin Phillips
@phillipskevin
Jul 27 2017 20:04
ok, cool
redirects?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:04
always when you google the stuff you get 2.3 stuff
@phillipskevin forgett simply about that as i can't define a issue for it
when i could i would do so
Kevin Phillips
@phillipskevin
Jul 27 2017 20:05
an issue for SEO?
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:05
but 100 times a day i land on 2.3 pages and then manual navigate to v3 stuff
its not really a SEO issue its a overall site design issue i think
and happens since this needed to get fixed
there was some redirect stuff
that was needed for 2.3 to work
The Most valid fix for that would be simply make 1 page where you can choose any version on the top left
Kevin Phillips
@phillipskevin
Jul 27 2017 20:07
you can do that on canjs.com
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:07
and not a splitted up 2.3 3.0 documentation
yes
there we can choose only the 1-2.3
its because google follows the redirects and all that i think
there is so much to consider simply forget about that is the most best solution at present still some one found time to merge that all together on canjs.com
still = till
at the canjs.com site the 2.3 link by the way always points to the main 2.3 site
Kevin Phillips
@phillipskevin
Jul 27 2017 20:11
right
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:12
but fixing all that would take about 2 weeks minimum 8 hours a day 5 days a week
is my estimate till all that would be good as it should be
so probally even 4.0 is out till that
Kevin Phillips
@phillipskevin
Jul 27 2017 20:12
I'm not sure what you're proposing
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:13
don't matters i have even no time to write the right proposal for that
but i think if you google simply stuff like can-route can-define-map
and so on you will regonize that it don't gives good results
sorry i am wrong
when we use it with the - minus then we get right results
Kevin Phillips
@phillipskevin
Jul 27 2017 20:14
sometimes
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:14
without it we get bad results
Kevin Phillips
@phillipskevin
Jul 27 2017 20:14
can-route gives you 2.3
I understand that
just not what you're proposing as a solution
Frank Lemanschik
@frank-dspeed
Jul 27 2017 20:15
ya stuff like that it don't matters it only happens because i am often to fast and hurry
i always want to do stuff fast
it will improve over time
DaveO
@DaveO-Home
Jul 27 2017 20:24
Follow Up - I now getting this warning - I think on element.empty() <-- jquery
WARN: can-util/dom/events::dispatch: Dispatching a synthetic event on a disabled is problematic in FireFox and Internet Exprorer. We recommend avoiding this if at all possible. see canjs/can-util#294
How to fix?
Kevin Phillips
@phillipskevin
Jul 27 2017 20:27
you get that when the app starts?
DaveO
@DaveO-Home
Jul 27 2017 20:27
Whenever a new page is loaded.
Kevin Phillips
@phillipskevin
Jul 27 2017 20:30
I think you can just ignore it
there's an issue to fix that warning
which I cannot find at the moment
DaveO
@DaveO-Home
Jul 27 2017 20:31
It looks like it is issued 9 times on the first page load.
Kevin Phillips
@phillipskevin
Jul 27 2017 20:34
actually... the issue I was thinking of was fixed
in can-util@3.9.4
so if you have that, you probably are dispatching events that aren't going to work
DaveO
@DaveO-Home
Jul 27 2017 20:35
I'm using 3.9.6
I have that problem using Karma, I have to use raw javascript to trigger events.