These are chat archives for canjs/canjs

11th
Oct 2018
Kevin Phillips
@phillipskevin
Oct 11 2018 00:52
@ivospinheiro it doesn't work with "automounted" components
it will still work within a component's view
Justin Meyer
@justinbmeyer
Oct 11 2018 03:22
@phillipskevin we really should give a warning
lets create an issue tomorrow :-)
@/all Here's the debugging video I made yesterday/today: https://www.youtube.com/watch?v=bJOEr9IltAw
There will be a bitovi blog post tomorrow
If you want to jump to logStack: https://youtu.be/bJOEr9IltAw?t=824
Frank Lemanschik
@frank-dspeed
Oct 11 2018 06:41
@phillipskevin this is not really correct i am working for example at present on a donejs replacment using rollup directly + canjs.mjs build and found out
that when u use firefox for example <my-comp /> gets rendered right
because firefox renders that as <my-comp></my-comp>
maybe chrome and some others don't do but the main point is it depends on the rendering engine if <my-comp /> works or not
nmingneau
@nmingneau
Oct 11 2018 08:14
@justinbmeyer Ok, apparently button elements aren't draggable in firefox due to a bug. I had to do a hack with :after to make it work and not break accessibility.
Kevin Phillips
@phillipskevin
Oct 11 2018 14:08
@frank-dspeed what is not correct?
can you show more of the code around <my-comp />? I'm not sure what you're doing exactly.
Marc Godard
@MarcGodard
Oct 11 2018 18:06

Hi Guys, I have the following function on my view model:

  addTier () {
    if (this.editItem && this.editItem.allPrices) {
      let currentLen = this.editItem.allPrices.length
      this.editItem.allPrices.push({ qty: (currentLen + 1), price: 0 })
    }
  },

When I run the function, it works, it pushes the new object, however the stache doesn't update:

              {{#each scope.top.editItem.allPrices}}
                <div class="row">
                  <div class="col-sm-5">
                    <div class="form-group">
                      <label>Quantity Start</label>
                      <input type="number" class="form-control" value:bind="qty" {{#if (scope.top.disableForm)}}disabled{{/if}}>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-group">
                      <label>Price</label>
                      <input type="number" class="form-control" value:bind="price" {{#if (scope.top.disableForm)}}disabled{{/if}}>
                    </div>
                  </div>
                  <div class="col-sm-2">
                    <label>&nbsp;</label>
                    <button class="btn btn-danger btn-block">Del</button>
                  </div>
                </div>
              {{/each}}

What am I missing?

Or how should I be doing this?
Justin Meyer
@justinbmeyer
Oct 11 2018 18:16
@MarcGodard which version of CanJS?
@/all Hey folks, I published the debugging tutorial: https://twitter.com/justinbmeyer/status/1050427982895095809
Kevin Phillips
@phillipskevin
Oct 11 2018 18:19
@MarcGodard what is editItem.allPrices ?
a DefineList ?
if it's a normal array, it won't be observable
Marc Godard
@MarcGodard
Oct 11 2018 18:20
canjs 4
and let me check.
no it isn't.
@phillipskevin because in my model, I made it type: 'any'
Kevin Phillips
@phillipskevin
Oct 11 2018 18:21
ok
Marc Godard
@MarcGodard
Oct 11 2018 18:21
What type should I use for an array or objects
Kevin Phillips
@phillipskevin
Oct 11 2018 18:22
DefineList
Marc Godard
@MarcGodard
Oct 11 2018 18:22
In my model?
Kevin Phillips
@phillipskevin
Oct 11 2018 18:22
if you want it to be observable
Marc Godard
@MarcGodard
Oct 11 2018 18:22
Never done that before... I guess I will also need the capital t lol
@phillipskevin Works, thanks. Didn't know I could do that
Kevin Phillips
@phillipskevin
Oct 11 2018 18:26
:thumbsup:
Frank Lemanschik
@frank-dspeed
Oct 11 2018 18:34

@phillipskevin it was about your answer to t

@ivospinheiro it doesn't work with "automounted" components

that was not correct <my-component /> works with automount components in firefox for example
as the engine renders the start and end tag in the dom representation
but it was only a general information so not so importent only to make that clear
@phillipskevin https://github.com/donejs/done-serve/issues/67#issuecomment-428991698 what do you think about that?
turn off h2 support or commit standart unsecure ssl certs and enable h2 by default i think that issue needs more attention
Kevin Phillips
@phillipskevin
Oct 11 2018 19:27
@frank-dspeed <my-component /> works, yes. But <my-component><h1>Hello</h1></my-component> will not render <h1>Hello</h1> if you try to use <content /> inside of <my-component>'s template.
if <my-component> is "automounted"