2

I'm using Backbone with Marionette and I have one troublesome route that seems to be firing twice, with different route parameters. When you click back, it brings you back to the first firing of the route, not the original page. Using Backbone Debugger, I can see that I have 6 different routers and only one of them (highlighted) has the applicable route. So there's only one instance.

enter image description here

The route is being triggered by a plain old link. I'm not using navigate(). Here is the actual link HTML:

<a href="#device/3/hash/84855d0624dbeb7957cad7d09f7faca78166f033ab71e53aa6199f285d6d903f/incident/8IFVA" class="btn btn-actions action-details">
    <span></span> &nbsp;App
</a>

When I click on that link, you can see the route being triggered with two different signatures:

enter image description here

enter image description here

I feel like I may be misunderstanding how Backbone routes work, why my route definition is matching with and without the incidentId. Here's the funny thing. If I take that link and just paste it into the browser, the route is only triggered once.

4

1 回答 1

2

通常,当路由或事件多次触发时,这通常意味着在您来回导航时视图未正确布置。

由于您确定您没有进行任何手写导航,因此似乎就是这种情况,尤其是当您手动访问 URL 时只看到一次此触发器时。

没有看到您的路由器或查看代码,很难真正为您提供可靠的解决方案。我会开始在该特定路由处理程序上放置断点并检查触发它的调用堆栈。

于 2013-10-22T19:23:22.713 回答