gpt4 book ai didi

javascript - Turbolinks 似乎加载了我的页面两次

转载 作者:行者123 更新时间:2023-11-28 08:44:20 25 4
gpt4 key购买 nike

一开始我没有注意到它,但我的应用程序表现得很奇怪:每次我单击 link_to 生成的链接时页面加载了两次。

确实,在控制台中:

Started GET "/registrations" for 127.0.0.1 at 2013-11-18 16:58:30 -0800
Processing by RegistrationsController#index as HTML
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
Registration Load (0.4ms) SELECT "registrations".* FROM "registrations"
Rendered registrations/index.html.erb within layouts/application (2.7ms)
Rendered layouts/_alerts.html.erb (0.1ms)
Completed 200 OK in 7ms (Views: 5.4ms | ActiveRecord: 0.7ms)


Started GET "/registrations" for 127.0.0.1 at 2013-11-18 16:58:41 -0800
Processing by RegistrationsController#index as HTML
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
Registration Load (0.3ms) SELECT "registrations".* FROM "registrations"
Rendered registrations/index.html.erb within layouts/application (1.9ms)
Rendered layouts/_alerts.html.erb (0.1ms)
Completed 200 OK in 7ms (Views: 4.5ms | ActiveRecord: 0.8ms)

我到处寻找解决方案,但人们不断提到开发环境中预编译 Assets 的问题,这不是我的情况。

我通过从 Rails 4 应用程序中删除 Turbolinks“解决”了这个问题,但这确实是一个“强力”解决方法。

这里有人遇到同样的情况吗?

作为引用,这是我的 <head>删除涡轮链接之前:

<head>
<title>Title</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag "//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css", media: "all" %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= javascript_include_tag "//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js" %>
<%= csrf_meta_tags %>
</head>

最佳答案

我想知道这是否与this ticket有关

编辑:这就是解决方案。这是一个已知的 chrome bug。更新您的 turbolinks gem 即可解决问题(已在 1.3.1 中修复)。

解决方案: 捆绑更新turbolinks

关于javascript - Turbolinks 似乎加载了我的页面两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20061309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com