Ember.js with Rails4: browser back button crash ember application

让人想犯罪 __ 提交于 2019-12-01 01:21:49

问题


EDIT: the issue is solved. Removing turbolinks is all you need to do.

With a Rails4 application the use ember-rails 0.13.0 we have a problem of not functional browser back button. Each time while getting back to previous route using the back button the application is crashing with such errors:

on Firefox 24.0a2:

TypeError: Class.PrototypeMixin.applyPartial is not a function @ http://localhost:3000/assets/ember.js?body=1:11933

on Chromium 28:

Uncaught Error: jquery-ujs has already been loaded! jquery.js?body=1:517I 
DEBUG: ------------------------------- ember.js?body=1:364
DEBUG: Ember.VERSION : 1.0.0-rc.6.1 ember.js?body=1:364
DEBUG: Handlebars.VERSION : 1.0.0 ember.js?body=1:364
DEBUG: jQuery.VERSION : 1.10.2 ember.js?body=1:364
DEBUG: ------------------------------- 

It looks like the whole application stack is loaded again that ends with not functional code base. Anyway the same application works perfectly good with Rails3.

Reports from other people having problems with ember.js together with turbolinks:

Cannot perform operations on a Metamorph that is not in the DOM

回答1:


After some debugging we had noticed those are turbolinks causing the problem. Using backbutton triggered turbolinks which were causing strange effects with the ember.js application like reloading all javascripts and thus overriding the state of app.

Removing turbolinks done the job. Here is a useful link how to do it: http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4



来源:https://stackoverflow.com/questions/18142401/ember-js-with-rails4-browser-back-button-crash-ember-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!