jlkalberer / Appcelerator-Mvc

Mvc Framework for Appcelerator
Other
20 stars 1 forks source link

Action from Action call makes extra pass through Default route #3

Open wvdbosch opened 13 years ago

wvdbosch commented 13 years ago

Hi John,

Last week you posted an updated mvc.js, based on our discussion at

http://johnkalberer.com/2011/09/13/appcelerator-mvc-routing/#comment-69

This allowed for actions to be called from within an action in a controller's code. Perfect for our purposes.

However, after successfully calling and executing the action, the framework somehow proceeds to call the default routed action as well, in the background. I know it's the default, catch-all action, since I changed that value in the app.js a couple of times in my tests prior to this post. Each time, the correct action would be called, then followed up by the default action.

That default action call goes on in the background somehow, not replacing the contents of the screen. An alert snuck away in the default action's code does get shown however.

For now I'm just making the default action something harmless, but of course this is no solution.

Any idea on where the routing might go wrong? My understanding of mvc.js is insufficient to go digging in it myself.

I'd be happy to offer you more information or do some more testing though. Let me know what to do.

wvdbosch commented 13 years ago

Small update. Did some fooling around in MVC.js anyway and made the following change to your revised MVC.js file, solving my issue :

Line 139 if(!view) { To If(!view || !view.action)

Not sure whether it'll cause me any issues down the line, but this effectively solves the double pass issue for now.

Wouter