These are chat archives for canjs/canjs

23rd
May 2018
Gregg Roemhildt
@roemhildtg
May 23 2018 00:45
@phillipskevin have you tried/gotten the can-dev-tools to work with webpack dev server? I'm not sure why but webpack doesn't seem to like can-debug
Chasen Le Hara
@chasenlehara
May 23 2018 01:11
Is it not behaving with the latest version of the extension (0.0.6 I believe)?
Gregg Roemhildt
@roemhildtg
May 23 2018 01:17
Yeah, webpack can't seem to find it. Its in my package.json
Uncaught Error: Cannot find module "can-debug"
    at webpackMissingModule (webpack:///./src/index.js?:1)
    at eval (webpack:///./src/index.js?:1)
    at Object../src/index.js (main.bundle.js:17173)
    at __webpack_require__ (main.bundle.js:753)
    at fn (main.bundle.js:122)
    at eval (webpack:///multi_(:9000/webpack)-dev-server/client?:2:1)
    at Object.0 (main.bundle.js:17206)
    at __webpack_require__ (main.bundle.js:753)
    at main.bundle.js:2406
    at main.bundle.js:2409
Gregg Roemhildt
@roemhildtg
May 23 2018 13:06
You guys ever run into this in IE11/canjs 4? Cannot redefine non-configurable property '@@symbol38can.onKeyValue'? Seems like can is trying to define a symbol that's already defined on the object.
Chasen Le Hara
@chasenlehara
May 23 2018 18:20
@roemhildtg Is that error from webpack because you have a require("can-debug") (or equivalent) import somewhere? Sorry I’m a little confused. 😅
Gregg Roemhildt
@roemhildtg
May 23 2018 18:21
Yeah, I'm just importing it with import 'can-debug';
And using babel-loader to load all js files
Chasen Le Hara
@chasenlehara
May 23 2018 18:27
One weird trick I’d like you to try ;) In node_modules/can-debug/package.json, could you change main to point to can-debug or can-debug.js instead of dist/cjs/can-debug?
I noticed there’s no dist folder in the version on npm and I’m wondering if that’s what the issue is
Gregg Roemhildt
@roemhildtg
May 23 2018 18:33
Thanks, I'll give that a try shortly
Nico R.
@nriesco
May 23 2018 19:47

Hi, I'm stucked here.

I have this component:

<can-component tag="v2-common-form-input">
  <view>
    <input type="text" value:bind="currentData" />
  </view>
</can-component>

And I use it this way:

<!-- This works! -->
<v2-common-form-input currentData:bind="displayName" />

But I noticed warnings when using camel case so I changed it to current-data but it stopped working:

<!-- This does not work :-( -->
<v2-common-form-input current-data:bind="displayName" />

Why is this? I use can/done version 3

Thanks

Gregg Roemhildt
@roemhildtg
May 23 2018 19:49
I think I'd ignore that warning
Could be a bug in the version you're using
Nico R.
@nriesco
May 23 2018 19:50
so currentData:bind=‘someVar’ is ok then?
And current-data:bind=“someVar” is not ok?
Gregg Roemhildt
@roemhildtg
May 23 2018 19:50
Yup, that's the new(er) syntax in 3, 4
Nico R.
@nriesco
May 23 2018 19:51
Ok thanks
and what about warnings related to attributes of a custom tag, say <v2-common-form-input myValue=“one" /> => I got a warning that I have to use <v2-common-form-input myValue:from=“‘one’”>
Gregg Roemhildt
@roemhildtg
May 23 2018 19:55
I think they addressed that with myValue:raw="one"
Nico R.
@nriesco
May 23 2018 19:56
But usually one would be a variable
so I guess the ’one’ is to make sure it doesn’t search for var one
so it makes sense but it was easier to use myAttribute=“32” like params
Gregg Roemhildt
@roemhildtg
May 23 2018 19:56
yeah, raw accounts for that so you don't have to quote it
Nico R.
@nriesco
May 23 2018 19:56
I use them a lot
Gregg Roemhildt
@roemhildtg
May 23 2018 19:57
I did too
Nico R.
@nriesco
May 23 2018 19:57
Oh, sorry, I didn’t see the raw I thought it was from
that’s reasonable enought to me
Gregg Roemhildt
@roemhildtg
May 23 2018 19:58
Yeah, it wasn't so bad
Nico R.
@nriesco
May 23 2018 20:00
But that won’t work in version 3 will it?
Gregg Roemhildt
@roemhildtg
May 23 2018 20:00
Not sure when they added that
updating 3.x to 4.x though isn't bad. Just fix the warnings and you should be good to upgrade
Chasen Le Hara
@chasenlehara
May 23 2018 20:22
I think :raw="a string" was added in 4.0, just as an easier way of doing :from="'a string'"
@nriesco The reason why we deprecated doing something like myValue="one" is because it’s not clear if you want a binding or just want to set the attribute on the element, e.g. <my-component class="" /> (should the component’s VM have a class property?)
It’s removed in 4.0 so if you do class="" it will always be treated as regular html and not set up a binding :)
Nico R.
@nriesco
May 23 2018 20:34
ok thanks
another question
@roemhildtg said it was easy to move to version 4 if you fix the warnings. I have a warning and I’m trying to understand how to find it (the same operation is made almost everywhere so it will be a lot of work)
WARN: 47: "page" is not in the current scope, so it is being read from a parent scope.
I’ve fix in the past this kind of warnings
But is there something useful about the 47 ?
so I can try to find exactly where it is happening?
Chasen Le Hara
@chasenlehara
May 23 2018 20:38
Hm yeah, the warning message should point to the line number of the stache file where page is
It looks like it wasn’t able to figure out the filename…
Is this with can-stache 3.14.20?
Nico R.
@nriesco
May 23 2018 20:44
it’s hard to find … no filename available…
yes 3.14.20
Nico R.
@nriesco
May 23 2018 20:50
found them, thanks! they were in the index.stache
Chasen Le Hara
@chasenlehara
May 23 2018 20:52
🎉
I’d still like to figure out why the filename didn’t show up… in the app, is your index.stache rendered with done-autorender, or some other way?
If with steal… then with steal-stache 3.1.3?
Nico R.
@nriesco
May 23 2018 21:09
well, it is using done-autorender, I’m using donejs develop
I’m not sure in production what happens
Chasen Le Hara
@chasenlehara
May 23 2018 21:15
I’m also assuming done-autorender 1.5.2
Filed an issue about it: canjs/can-stache#520
Nico R.
@nriesco
May 23 2018 21:18
let me check
Yes, 1.5.2
not sure how to reproduce the error but probably when using components
Nico R.
@nriesco
May 23 2018 21:23
found something
I added some info to the issue @chasenlehara let me know if you need more info
Chasen Le Hara
@chasenlehara
May 23 2018 21:30
Thanks Nico! Hope it’s ok that I added <details> around the npm list output so it’s easier to read through the comment :D
Nico R.
@nriesco
May 23 2018 21:40
Can I ask you a question?
I’m getting rid of the warnings
but this one is tricky
I have this: <input class="form-control" value:bind="someVar" {{disabled}} {{required}} />
and it works but I get the warning Unable to find key or helper "disabled”. and Unable to find key or helper "required”.
on previous errors I had value=“{{someVar}}” and change it to value:from=“someVar” but in this case it’s not a property so I don’t know how to modify / access it
I’m guessing something like properties.required:from=“someVar”
Chasen Le Hara
@chasenlehara
May 23 2018 21:47
Just writing {{required}} should work just fine in 3.x or 4.x
That warning is supposed to indicate that it can’t find disabled or required in the template’s scope, which is not the case if it’s working correctly 😅
Chasen Le Hara
@chasenlehara
May 23 2018 21:52
Is that input nested in another component and passed to it as content, or something else like that?
In a really simple example I see no “unable to find key” warning: https://bitovi-jsbin.jsbin.com/luwivul/5/edit?html,js,output
Nico R.
@nriesco
May 23 2018 22:23
It’s a common/auxiliary component so it is being called from another component
Chasen Le Hara
@chasenlehara
May 23 2018 22:41
disabled or required are defined in the component that uses that template though, right?
Nico R.
@nriesco
May 23 2018 22:58
I’ll double check but they are passed as sort of parameters
something like this: <my-component required=“required" /> and I’ve been changing them to <my-component required:from=“‘required’” />
probably I missed one, it will take a while to verify
Nico R.
@nriesco
May 23 2018 23:04
I’m doing mass updates and see what happens
Chasen Le Hara
@chasenlehara
May 23 2018 23:14
Ok. I don’t think can-migrate handles changing stuff like required="required", but it can handle other things. The migration guide mentions can-migrate as a way to automate some of the changes: https://canjs.com/doc/migrate-4.html
Nico R.
@nriesco
May 23 2018 23:15
could it be that when calling the component I have <my-compoenent current:bind=“element" /> and I’m not defining required at all?