ManuelDeLeon / viewmodel

MVVM for Meteor
https://viewmodel.org
MIT License
205 stars 23 forks source link

Should functions fire on load? #206

Closed sirganya closed 8 years ago

sirganya commented 8 years ago

With this code on v 2.9.3 I'm seeing that the pickedUp function fires as the view is created. Is this the correct behaviour?

Template .button($b='click: pickedUp')

Viewmodel

pickedUp: ->
   console.info 'pickedUp`
ManuelDeLeon commented 8 years ago

It shouldn't, does it do that with the latest version? On Mar 12, 2016 12:13 PM, "Greg Kavanagh" notifications@github.com wrote:

With this code on v 2.9.3 I'm seeing that the pickedUp function fires as the view is created. Is this the correct behaviour?

Template .button($b='click: pickedUp')

Viewmodel

pickedUp: -> console.info 'pickedUp`

— Reply to this email directly or view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/206.

sirganya commented 8 years ago

I've been having some problems with the versions actually. I was on 2.9.3 then I realised that Meteor update wasn't giving the latest, so I updated with the --allow-incompatible-update flag and things started to break, so I downgraded and the funny behaviour started, although it seems to have stopped now. How would I find out if there's a package that's requiring viewmodel @2.9.3?

Viewmodel is awesome btw, thanks for creating it.

fvpDev commented 8 years ago

Check out https://github.com/ManuelDeLeon/viewmodel/blob/master/HISTORY.md : there are breaking changes with v3.0.0 and v4.0.0. To see which packages require viewmodel check out https://atmospherejs.com/manuel/viewmodel. in the bottom right there will be a list called "Dependants"

I highly suggest reading/scanning through the docs as well, as they have been updated with several new features since v2.9.3. https://viewmodel.meteor.com/

sirganya commented 8 years ago

Thanks, upgrading to the latest version fixed it.

Instructions are here for anyone who needs them.

https://atmospherejs.com/i/installing

sirganya commented 8 years ago

So after updating the functions then would not fire on click. In a group of three buttons with the same structure two were borked, one worked. There were no duplicate methods with the same name anywhere in the code and after much head scratching I changed the names of the bound methods for the two broken ones and they worked... huh? I'm clueless. The method name was used as a field on a record and is a key in a Tap:i18n language file.

ManuelDeLeon commented 8 years ago

I can take a look at it if you make me a repro without tap i18n (I'm not debugging a project with that again) On Mar 13, 2016 9:10 AM, "Greg Kavanagh" notifications@github.com wrote:

So after updating the functions then would not fire on click. In a group of three buttons with the same structure two were borked, one worked. There were no duplicate methods with the same name anywhere in the code and after much head scratching I changed the names of the bound methods for the two broken ones and they worked... huh? I'm clueless. The method name was used as a field on a record and is a key in a Tap:i18n language file.

— Reply to this email directly or view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/206#issuecomment-195974436 .

sirganya commented 8 years ago

Yoinks.. really? I'm getting all sorts of really strange behaviour. I'll remove tap i18n and get back to you if it's still the same.

sirganya commented 8 years ago

any i18n packages you like?

ManuelDeLeon commented 8 years ago

I don't use i18n in my Meteor apps. Sorry. On Mar 13, 2016 11:39 AM, "Greg Kavanagh" notifications@github.com wrote:

any i18n packages you like?

— Reply to this email directly or view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/206#issuecomment-196010993 .

sirganya commented 8 years ago

I added you to the project so you can take a look. It'd be much appreciated. The problem is in the client/shopadmin/pickups.coffee file. Excuse the messed up labels, i18n is switched of.f

ManuelDeLeon commented 8 years ago

That's not a repro but a full application. I can't debug your app. You need to give me the absolute minimum required to reproduce the problem.

sirganya commented 8 years ago

I understand but I can't reproduce it out of context. One of the buttons in the template fires, three don't. I've setup them up the same way in each case. :( It's a click bound to a function and it works perfectly in the other 37 cases in the app.

I've been looking at the default event binding as it's being called in your source code and can't see any difference in the bindArg between bindings that work and bindings that don't. I'll keep poking and see if I can gain any insight.

No worries if you can't get to it.

On Mon, Mar 14, 2016 at 3:07 PM, ManuelDeLeon notifications@github.com wrote:

That's not a repro but a full application. I can't debug your app. You need to give me the absolute minimum required to reproduce the problem.

— Reply to this email directly or view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/206#issuecomment-196358677 .