These are chat archives for canjs/canjs

27th
Nov 2017
Viktor Busko
@Lighttree
Nov 27 2017 07:14

@bmomberger-bitovi hmm...well this approach with Xvfb something that I didn't knew. It makes sense. But for now I think I'm ok with Node approach. seems to be working.

Are you using can-make-rest 0.1.2 or later and still seeing that issue?
I don't require it directly. It comes from dependencies for can-connect and there is 0.1.1 based on my package-lock.json

"can-connect": {
            "version": "1.5.10",
            "resolved": "",
            "integrity": "",
            "requires": {
                "can-ajax": "1.1.2",
                "can-compute": "3.3.9",
                "can-construct": "3.2.3",
                "can-define": "1.5.4",
                "can-event": "3.7.6",
                "can-list": "3.2.2",
                "can-make-rest": "0.1.1",
                "can-map": "3.4.1",
                "can-namespace": "1.0.0",
                "can-observation": "3.3.6",
                "can-reflect": "1.8.0",
                "can-set": "1.3.3",
                "can-stache": "3.13.4",
                "can-stache-bindings": "3.11.1",
                "can-types": "1.1.4",
                "can-util": "3.10.15",
                "can-validate-interface": "0.1.0",
                "can-view-callbacks": "3.2.3",
                "can-view-nodelist": "3.1.1",
                "steal-stache": "3.1.3"
            },
            "dependencies": {
                "can-make-rest": {
                    "version": "0.1.1",
                    "resolved": "",
                    "integrity": "",
                    "requires": {
                        "can-util": "3.10.15"
                    }
                }
            }
        },
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 15:55
Thanks for tracking that down. can-connect 1.5.12 depends on can-make-rest 0.1.2, so upgrading can-connect to latest should solve your problem without further action on your part.
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:30
Hey, just curious is this warning correct? value="1511802083000" is deprecated. Use value:from="'1511802083000'" instead.
You can no longer pass attributes to components using the simple key="value" syntax?
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 18:42
It's deprecated in large part because for regular attributes we have to convert kebab-case to camelCase
so if you had a component attribute like threeWordName the deprecated way would be three-word-name="value"
for the stache binding syntax like :from we can detect those bindings and convert them into a valid HTML attribute (three:u:word:u:name:from), so you can freely use the capitalization that matches your actual view model property names. (threeWordName:from="value")
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:45
I see. That clears it up. I've seen the three:u:word...stuff before and was always curious what the u's were
Kevin Phillips
@phillipskevin
Nov 27 2017 18:53
there are also problems where people try to add styles and other attributes to components and they also end up being set as properties on the viewModel
like <my-component style="color: red" /> can cause errors because the viewModel is sealed and it tries to set the color property on the viewModel
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 18:54
@phillipskevin for this reason I just use the custom tag as wrapper
Kevin Phillips
@phillipskevin
Nov 27 2017 18:55
yeah
people still try to do it though
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 18:55
or you have to let the viewModel been sealed
Kevin Phillips
@phillipskevin
Nov 27 2017 18:55
I don't think value:from="'1511802083000'" is bad
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:56
Its not, I was just curious
Kevin Phillips
@phillipskevin
Nov 27 2017 18:56
we haven't removed it from 4.0 yet, so willing to hear other opinions still
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:56
Do I need the extra set of quotes?
Or are those optional
Kevin Phillips
@phillipskevin
Nov 27 2017 18:56
you need them
if you want to use a string value
otherwise it will try to look up that property in the scope
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:57
So for boolean, I could do value:from="true"
Kevin Phillips
@phillipskevin
Nov 27 2017 18:57
that's a good question
I'd have to try it
Gregg Roemhildt
@roemhildtg
Nov 27 2017 18:59
Kevin Phillips
@phillipskevin
Nov 27 2017 19:01
ok, good
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:01
@bmomberger-bitovi the conversion to valid html attrs has issues with inline templates
I mean with autorender
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 19:02
Can you show me an example?
Gregg Roemhildt
@roemhildtg
Nov 27 2017 19:03
@phillipskevin Negative numbers are interesting. Gotta be quoted or they aren't passed
value:from="'-55'" instead of value:from="-55"
or value:from="'{{myNegativeNumber}}'" instead of value:from="{{myNegativeNumber}}"
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:04
@bmomberger-bitovi this example dosent convert the attrs
<div  type="text/stache" can-autorender id="booking-view">
<booking-form citiesData:from="citiesPromise"/>
</div>
but in the scope I found citiesdata instead of citiesData
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 19:05
hm. That may be a problem with autorender and it may also be an impossible situation because that's being parsed as DOM. Is there an issue filed for that?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:06
I think so @pYr0x opened one cc @phillipskevin
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 19:08
OK. So does it work if you do :
<div  type="text/stache" can-autorender id="booking-view">
<booking-form cities:u:data:from="citiesPromise"/>
</div>
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:08
TBH I didnt try it I was under pression :)
Kevin Phillips
@phillipskevin
Nov 27 2017 19:09
use a <script>
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:09
yes
Brad Momberger
@bmomberger-bitovi
Nov 27 2017 19:09
Freaking Kevin knows how to do everything.
Kevin Phillips
@phillipskevin
Nov 27 2017 19:09
canjs/can-view-autorender#70
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:09
yes it works fine with script
I use div
Kevin Phillips
@phillipskevin
Nov 27 2017 19:10
the DOM converts it then, we can't do anything about it
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 27 2017 19:10
beacuse of php and translations
Justin Meyer
@justinbmeyer
Nov 27 2017 22:36
Just did a few min on can-key-tree. Learn how to use it, how it works: https://www.youtube.com/watch?v=qVVB2MOO-yM