These are chat archives for canjs/canjs

6th
Feb 2018
Jeroen Cornelissen
@jeroencornelissen
Feb 06 2018 10:20
I’ve upgraded a component to 4.0 but I’m getting some warning from can-stach/expressions/lookup.js
Schermafbeelding 2018-02-06 om 11.18.45.png
Narrowed it down to an each loop:
{{#each(panels, panel=value)}}
    {{panel.label}}
{{/each}}

If I write it like this:

{{#each(panels)}}
    {{label}}
{{/each}}

It only warns this: can-stache/expressions/helper.js: Unable to find helper "label".

Frank Lemanschik
@frank-dspeed
Feb 06 2018 10:24
@jeroencornelissen yes i get the same errorys
but the funny thing is it renders
Jeroen Cornelissen
@jeroencornelissen
Feb 06 2018 10:25
ah, ok, I’m not the only one :smile:
Yes, it renders
Frank Lemanschik
@frank-dspeed
Feb 06 2018 10:25
no this is also a error in bitballs
this is all over
i am trying to specificating this bugs
as they are really general i got also some funny freezing and routing behaviors
your using feathers right?
Jeroen Cornelissen
@jeroencornelissen
Feb 06 2018 10:26
I removed all the ‘deprecation’ warnings in order to upgrade to 4.0, and now I’m getting these :smile:
No, not using feathers
Frank Lemanschik
@frank-dspeed
Feb 06 2018 10:26
ah ok
yes i am now getting also getting false positives
i simply ignore them at present till its more specificated
but you could start opening a issue and post it here
i will +1 it
:D
Frank Lemanschik
@frank-dspeed
Feb 06 2018 10:34
donejs/bitballs#318
Jeroen Cornelissen
@jeroencornelissen
Feb 06 2018 11:01
@frank-dspeed canjs/can-stache#461
cedricalfonsi
@cedricalfonsi
Feb 06 2018 11:33
Hi everybody, I'm currently migration from v2 to v3. I encounter an issue when I'm trying to migrate my associated models, they are recognized as Map and not with the model they should. I was using attributes to define my model attributes (deprecated). My models extend can-connect/can/model/model. If someone has a bone to throw me, don't hesitate ? :)
Nico R.
@nriesco
Feb 06 2018 13:12
Hi, I have problems with promises and catch. I created a small repo that basically has this code: https://github.com/nriesco/promise-catch/blob/master/index.js#L31-L61
If you run it, you’ll see unexpected results
I though that code should work but didn't
Pavel Rezunenko
@supar
Feb 06 2018 13:14
vue
sorry :) just want to ask how to pass class to component like in vue?
Pavel Rezunenko
@supar
Feb 06 2018 13:24
<my-component class="baz boo"></my-component> and get <p class="foo bar baz boo">Hi</p>
cedricalfonsi
@cedricalfonsi
Feb 06 2018 13:36
Just in case, it can be useful to someone else, hydrateInstance helps me to solve my issue
Gregg Roemhildt
@roemhildtg
Feb 06 2018 14:02
@supar I ususally use something like this:
<my-component buttonClass:from="btn btn-default"></my-component>
Template.stache:
<button class="{{buttonClass}}">Button</button>
Pavel Rezunenko
@supar
Feb 06 2018 14:20
@roemhildtg I found this too, thanks. But key should be escaped <my-component buttonClass:from="'btn'"></my-component> otherwise will be warning
I think this case need to describe in the API documentation
Gregg Roemhildt
@roemhildtg
Feb 06 2018 14:43
Yes, that's right.
Yeah 4.x what I wrote won't work
Gregg Roemhildt
@roemhildtg
Feb 06 2018 16:46
Is there a proper way to remove a stache template from the dom? Other than document.body.removeChild(domNode)?
Gregg Roemhildt
@roemhildtg
Feb 06 2018 16:58
I'm inserting the template like this:
div = document.createElement('div');
div.appendChild(stache(...)());
document.body.appendChild(div);
Kevin Phillips
@phillipskevin
Feb 06 2018 17:21
CanJS 4.0 is officially out: https://www.bitovi.com/blog/canjs-4.0 :tada: :tada: :tada: :tada:
Gregg Roemhildt
@roemhildtg
Feb 06 2018 17:25
:balloon:
Kevin Phillips
@phillipskevin
Feb 06 2018 17:27
@roemhildtg in 4.0 it definitely shouldn't matter how you remove your template
we're using a MutationObserver to listen for when elements are removed and do any necessary cleanup
Gregg Roemhildt
@roemhildtg
Feb 06 2018 17:28
Okay cool! Just wanted to check on that. I was worried some memory leaks might occur if I don't cleanup correctly
Justin Meyer
@justinbmeyer
Feb 06 2018 17:57
@phillipskevin I'm not sure we 100% cleaned that up yet. It should be possible now, but I can't remember if we confirmed. Chris would know
Gregg Roemhildt
@roemhildtg
Feb 06 2018 18:20
Is there a better way @justinbmeyer ? I need to display a modal dialog (canjs component) occasionally and remove it. What would be the "safest" way to insert and remove stache templates with a DefineMap viewmodel?
Justin Meyer
@justinbmeyer
Feb 06 2018 18:52
@roemhildtg as long as your "live" sections are within a div or some other element like stache("<div> {{liveStuff}} </div>") ... you are fine
this will be safe even in 2.0
In 3.0, the new mutation observer stuff SHOULD be able to make it so you can have live stuff anywhere without any special cleanup
but I haven't confirmed for myself we did that
Gregg Roemhildt
@roemhildtg
Feb 06 2018 18:54
Okay sounds good!
Justin Meyer
@justinbmeyer
Feb 06 2018 18:54
@/all hey, 4.0 is out. It's latest on hacker news if you want to upvote :-) https://news.ycombinator.com/newest
Frank Lemanschik
@frank-dspeed
Feb 06 2018 18:55
at present i need to get something working with 4.0
befor i upvote
at present i see many issues that are blocking
Justin Meyer
@justinbmeyer
Feb 06 2018 18:56
yesh @frank-dspeed
Frank Lemanschik
@frank-dspeed
Feb 06 2018 18:57
and they are hard issues you will get much fun :)