These are chat archives for canjs/canjs

10th
Aug 2018
nmingneau
@nmingneau
Aug 10 2018 06:49
@phillipskevin Hi, it seems that the debugger works with a viewModel but not with a defineMap.
Jeroen Cornelissen
@jeroencornelissen
Aug 10 2018 07:26
@nmingneau @phillipskevin here is a demo of how we use it and it doesn't work: https://codepen.io/JeroenC82/pen/RBEymY
Kevin Phillips
@phillipskevin
Aug 10 2018 14:16
I think maybe there's some confusion about what logWhatChangesMe does
logWhatChangesMe lists the other observables that an observable depends on
so... things it derives its value from or things that mutate it
Kevin Phillips
@phillipskevin
Aug 10 2018 14:22
@nmingneau @jeroencornelissen did you take a look at https://canjs.com/doc/guides/debugging.html#Debugwhatcausedaobservableeventorupdatetohappen_ ? There is probably more information we can give to make this easier to understand.
Jeroen Cornelissen
@jeroencornelissen
Aug 10 2018 14:22
thx, will have a look
qantourisc
@qantourisc
Aug 10 2018 15:59
in a stache template {#data} <my-component vm:data:from="."/>{/data} how do I access the my-components (In this example, to send all of them a signal to do something.) Or is the right way to do it: make data is a list of my-component.viewModel's and then do something like <my-component-display vm:from_parent:from="."/> ?
Ivo Pinheiro
@ivospinheiro
Aug 10 2018 16:12

Hi!
I'm working to remove all the warnings on my application related with the stache binding changes using can@3.13.1
I'm setting a component property value directly on stache like this:

<root-component component-title="home"/>

I receive a console warning stating:
component-title=\"home\" is deprecated. Use component-title:from=\"'home'\" instead."

So it should be :

<root-component component-title:from="'home'"/>

But the only way that works is:

<root-component componentTitle:from="'home'"/>
What should be the right way to do this on can@4?
Gregg Roemhildt
@roemhildtg
Aug 10 2018 16:50

@ivospinheiro raw was implemented at some point to handle this. Not sure when this was implemented, but I think it was 4.x. You can do componentTitle:raw="home"

If that doesn't work, you can still do componentTitle:from="'home'". You need the quotes inside the double quotes, and use the full view model property, not with dashes.

Ah it was 4.1 - https://github.com/canjs/canjs/releases/tag/v4.1.0 when prop:raw="rawValue" was implemented
Ivo Pinheiro
@ivospinheiro
Aug 10 2018 17:21
In can@4 we don't need to hyphenate the properties anymore as we were doing on can@3, right?
Maybe the warning messages needs to be updated
Gregg Roemhildt
@roemhildtg
Aug 10 2018 17:41
Correct. No hyphens
Unless you want to set something like data-stuff="...." on the element itself
Kevin Phillips
@phillipskevin
Aug 10 2018 18:29
yes, I think that warning message is incorrect
Marc Godard
@MarcGodard
Aug 10 2018 19:36

Anyone know this error?

Uncaught TypeError: Cannot read property 'Symbol(can.getKeyValue)' of undefined
    at Object.getKeyValue (get-set.js:78)
    at Behavior.id (map.js:100)
    at Behavior.getInstanceMetaData (store.js:330)
    at Behavior.behavior.(anonymous function) [as updatedInstance] (http://localhost:8080/node_modules/can-connect/constructor/callbacks-once/callbacks-once.js:84:30)
    at Behavior.updatedData (real-time.js:271)
    at Behavior.updateInstance (real-time.js:304)
    at eval (real-time.js:202)

The code causing this is:

    let newItem = new PageItem2()
    newItem.assign(item.serialize())
    newItem.save()
      .then(() => {
        item.destroy()
      })

Everything look fine, and I use this type of code elsewhere (slightly differently) and it works.

qantourisc
@qantourisc
Aug 10 2018 19:43
@MarcGodard What would work ?
Marc Godard
@MarcGodard
Aug 10 2018 19:53
What do you mean?
@qantourisc ^^
Marc Godard
@MarcGodard
Aug 10 2018 20:00
I tried to match how the other code that works works, and still getting the error.
qantourisc
@qantourisc
Aug 10 2018 20:08
give me "the other code"
so I can diff it
Marc Godard
@MarcGodard
Aug 10 2018 21:37

@qantourisc

  payItem (item) {
    console.log(item)
    console.log(item.serialize())
    this.edit.assign(item.serialize())
    console.log(this.edit)
    console.log(this.edit.serialize())
    this.edit.save()
      .then(returned => {
        console.log(returned)
      })
  },

This is how the other code does it by putting the object on the view Model.

  edit: {
    Type: PageItem2,
    default () {
      return new PageItem2({})
    }
  },

Everything console logs fine. The error happens on the save() call

qantourisc
@qantourisc
Aug 10 2018 22:05
I am sorry I am missing tomuch context to help you.