These are chat archives for canjs/canjs

19th
Dec 2017
Frank Lemanschik
@frank-dspeed
Dec 19 2017 16:02
@bmomberger-bitovi does that mean your existing syntac works with 1.4.0?
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 16:24
Yes, the set including $limit/$skip/$sort now passes Algebra.has() with matching instances.
Viktor Busko
@Lighttree
Dec 19 2017 17:52

Guys, I have a question regarding canjs dependencies. My app has following dependencies:

  "dependencies": {
    "entity-details-component": "^0.2.1",
    "can-component": "^3.3.4",
    ...
    "can-define": "^1.4.4",
    ...
    "can-stache": "^3.6.2",
    ...
  }

There is entity-details-component - custom canjs component developed separately from main app (like donejs plugin). And the idea is that It can be reused in different apps. Its dependencies:

 "dependencies": {
        "can-component": "^3.3.7",
        "can-define": "^1.5.4",
        "can-stache": "^3.14.5"
 }

As you can see there are different versions of can-{something} in dependencies.
Is this something that can lead to issues or should be ok ? I'm asking because I got some errors like You have 2 versions ofcan-cidcheck your dependencies, but after some cleaning re-install etc. this issues disappeared.

I was thinking that this will be resolved and all required versions of dependencies will be downloaded, but these console errors made me worry about this.
Kevin Phillips
@phillipskevin
Dec 19 2017 17:58
we throw those errors for the can-* dependencies that can cause problems if you load multiple versions
for example... can-view-callbacks is where we keep the list of tags you register with can-component
Frank Lemanschik
@frank-dspeed
Dec 19 2017 17:59
oh god bless kevin is there
Kevin Phillips
@phillipskevin
Dec 19 2017 17:59
so if you register with one version... and stache uses a different version when trying to find your components, your app won't work
this is one of the obvious ones, but there are much more subtle issues that you might not notice right away
Frank Lemanschik
@frank-dspeed
Dec 19 2017 17:59
@phillipskevin i get a lot of warnings about the fact that i should use ~/ to load my modules
Kevin Phillips
@phillipskevin
Dec 19 2017 18:00
so... to answer your question, if you're not seeing those errors, you should be safe
Frank Lemanschik
@frank-dspeed
Dec 19 2017 18:00
because they are loaded twice but i think thats false
Viktor Busko
@Lighttree
Dec 19 2017 18:00
hmm... so I need to freeze versions of dependencies across all apps and components ? or there is some another way ?
Frank Lemanschik
@frank-dspeed
Dec 19 2017 18:00
it lists can-* modules
that are only loaded via steal normal donejs pattern
is that expected?
Kevin Phillips
@phillipskevin
Dec 19 2017 18:00
@Lighttree you shouldn't need to freeze your dependencies
(although it might not hurt)
but you'll want to use the same range as much as you can
starting in a moment
Kevin Phillips
@phillipskevin
Dec 19 2017 18:01
@frank-dspeed no I don't think that's expected
also, @Lighttree you may want to :+1: this issue: canjs/canjs#3767
or vote for it in our next donejs survey
Frank Lemanschik
@frank-dspeed
Dec 19 2017 18:07
@phillipskevin did you ever run into the fact that modules that you import via its npm name get logged as loaded twice?
i have simply no idea how that can happen when they all have the same name i get that also for moment and that kind of stuff
jquery
it works it loads but the warning are not logical
Kevin Phillips
@phillipskevin
Dec 19 2017 18:19
I know we've talked about this a couple times... I think in contributor's meetings
let me try to find the issue
Frank Lemanschik
@frank-dspeed
Dec 19 2017 18:20
i remember something like that but i never got this issue in such a scary way
but it also found out something really dynamic
that will instance some stuff twice
i found out that debug npm module exports diffrent src/browser.js in browser and /src/index.js in node
i will simply ignore that as it works but i hate that i don't understand why that fires and how and where :) i think thats only solve able via steal tooling in a later state i would need to run all kind of builds and analyze the graph results and that
i get scared when i only write about that :)
Kevin Phillips
@phillipskevin
Dec 19 2017 18:23
there are a couple issues open about these warnings
stealjs/steal#1285 stealjs/steal#1298 stealjs/steal#1317
Frank Lemanschik
@frank-dspeed
Dec 19 2017 18:24
ya i think they are ok as they are warnings
Ranjan Subbiah
@ranjanbuilds
Dec 19 2017 19:22
hey, I have a ($click) event handler in my button element and I'd like it to call a function in the parent component, what's the best way to go about doing this?
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:26
is some one still alive? if yes i have a new nice issue that i don't understand :)
_type: 'Artist',
don't works anymore on can-define/map extend
it errors it looks like this fild is now used internal=?
and replaced Type?
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:27
@ranjanbuilds we have two competing practices for this. The one that I usually go to is to pass the function from parent to child using a binding:

parent Stache:

<child-component clickHandler:from="@clickHandler" />

child-component.js:

var ViewModel = DefineMap.extend({ clickHandler: "*" })

child Stache:

<button on:click="clickHandler()" >click me</button>
The other one is to dispatch an event from the child component and listen for that event on the parent to fire a handler

parent Stache:

<child-component on:vm:buttonClick="parentClickHandler()" />

child-component.js:

var ViewModel = DefineMap.extend({ childClickHandler: function() { this.dispatch("buttonClick"); } })

child Stache:

<button on:click="childClickHandler()" >click me</button>
Ranjan Subbiah
@ranjanbuilds
Dec 19 2017 19:32
awesome, thanks very much @bmomberger-bitovi
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:33
You're welcome.
One important thing to point out: when passing a function like that, when it's executed, this will be the view model where it's defined (in this case, the parent component), not the one where it was referenced when called (the child component)
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:34
@bmomberger-bitovi ERROR: # on DefineList does not match a supported propDefinition do you know if something changed about that
my last state was * got #
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:35
What's the value for "#"?
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:35
good question :)
it was nothing as it was *
thanks for pointing that out
my codemod did not run right
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:36
aha.
Yes, the conditions for that warning to fire are if the value of a property definition is undefined or an unknown definition
Also with regards to your question about the _type field, the string 'Artist' isn't a known default type. Was that supposed to be its initial value?
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:40
yes sorry i got that point :)
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:40
:+1:
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:40
i need to do value: and type on that
Brad Momberger
@bmomberger-bitovi
Dec 19 2017 19:40
correct
Frank Lemanschik
@frank-dspeed
Dec 19 2017 19:40
but it was some how working befor
i am so happy when all is working again i hate it to convert big apps
need some better ways :)
always try and error takes much time
Kevin Phillips
@phillipskevin
Dec 19 2017 19:43
:heavy_plus_sign:
Frank Lemanschik
@frank-dspeed
Dec 19 2017 23:31
I hope that when Justin did explain about scope and view I am able to finally just implement streams
The new observation makes me always think with streams we got all that and more
And can also use any input and throw any output no decorations needed
I am sure once we got a layer to easy generate and update values in a template on change we can simply do observation as streams of values
Frank Lemanschik
@frank-dspeed
Dec 19 2017 23:38
I am playing around with it a lot I am only not sure about partial paradigm and that maybe I need to create some own stache or mustache implementations I don't know but I don't like the new observation it's same black box as befor but now using proxy's I like proxy's but I don't like libs using them :)
But when any one has a simple idea about how to rerender a value inside a template on change without rerender the fragment let me know
My only idea would be to create extra fragments per value and rerender that