title: calling Backbone.history.navigate(...) leads to recursion?
body: <p>I am using bootstrap, backbone, marionette in my app with require js support. This is a moderately large application with many views and sub views.  As it consists of tabbed display, I am using bootstrap tabs.</p>
  
  <p>In my layout view, I am handling the tab shown event and trying to do tab pane specific rendering as below...</p>
  
  <pre><code>var AppLayoutView = Backbone.Marionette.LayoutView.extend({
      el : "body",
      regions: {
          headerRegion: "#ecp_header",
          bodyRegion: "#ecp_body",
          contentRegion: "#home"
      },
  
      events: {
          'shown.bs.tab ul.nav-tabs a': 'onTabShown'
      },
  
      ...
  
      onTabShown: function(e) {
          var self = this;
          console.log("App layout view: 'onTabShown' executing...");
          var tabId = $(e.currentTarget).attr('id');
  
          if (tabId === 'home-tab') {
              /**  Show the dashboard (home) view */
              require(['user_dashboard_layout'], 
                      function(UserDashboardLayoutView) {
  
              // update the URL in addressbar, so it can be available in history stack     
              Backbone.history.navigate('dashboard');
  
              var dbLytView = new UserDashboardLayoutView();
              dbLytView.render();
              //self.bodyRegion.show(dbLytView);
              //self.contentRegion.attachView(dbLytView);
              });
          } else if (tabId == "scheduling-tab") { ... }
  </code></pre>
  
  <p>All of this was working decently, until I added the line the history navigation line as shown in the above code.</p>
  
  <pre><code>Backbone.history.navigate('dashboard');
  </code></pre>
  
  <p>I also added app_controller to take care of routing.  But after this, I observe a strange behavior.  I see that the above fn "onTabShown" gets invoked multiple times, as seen in the browser console window (screenshot attached), whenever I perform login/logout on my app.
  <img src="https://i.stack.imgur.com/fG8Ta.png" alt="enter image description here"></p>
  
  <p>BTW, in my SPA (single page app), when user logs in, I show dashboard (if the user is logged in), or show welcome page (if not logged in).</p>
  
  <p>If the offending line (history.navigate(...)) is present, I can see that tabShown is invoked multiple times, that is, for each login/logout it gets accumulated (some sort of strange recursion, or stack is not unwound). </p>
  
  <p>But, if I comment out the history.navigate line, it doesn't perform page refresh after logout.</p>
  
  <p>My basic question is... </p>
  
  <ul>
  <li>"does the backbone.history.navigate(...) fn play any role in actual page navigation/refresh, apart from just updating the history stack?</li>
  </ul>
  
  <p>From the documentation, it appeared that we need to call bb.h.navigate(...) just to keep the url in addressbar in sync with our current state of app.  However, I am experiencing this strange behavior?</p>
  
  <p>Since the app is a bit fairly complex, I may not have provided all relevant details for soliciting a proper answer to this qn.  </p>
  
  <p>May someone point me in right direction...?</p>