控制器操作被调用两次

发布于 2024-09-27 06:09:34 字数 1469 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

魂牵梦绕锁你心扉 2024-10-04 06:09:34

我已经弄清楚了。

这种行为的原因是 JavaScript 代码,在页面加载后被调用。此代码实现了页面某些部分的深度链接。

对此要小心。

谢谢。

I've figured it out.

The reason of such a behavior was a JavaScript code, being called after page load. This code implements deep-linking for some parts of the page.

Be careful about this.

Thanks.

不打扰别人 2024-10-04 06:09:34

我遇到了类似的问题,在我们的例子中,如果 pjax 没有在 6 秒内完成,它是一个有问题的 pjax 代码,超时时间为 6 秒,导致一个额外的请求(即一个额外的常规 HTML 请求)。

I faced similar issue and in our case it was an offending pjax code with 6s of timeout resulting in one extra request (i.e. one extra regular HTML request) if pjax didn't complete in 6s.

乖乖哒 2024-10-04 06:09:34

另一件需要检查的事情是您是否将 PostCSS 列为 package.json 中的依赖项。如果您这样做,并且您没有postcss.config.json 文件,请修复该问题。最基本的文件似乎是

module.exports = {
    plugins: []
}

重新启动服务器、重新加载页面并检查服务器日志。应该只有一个请求被报告为已处理。

参加聚会已经很晚了,但希望这对某人有帮助。我暂时被一个琐碎的 Rails 6.1.4.1 应用程序所看到的日志所困扰。

Another thing to check is whether you have PostCSS listed as a dependency in your package.json. If you do, and you don't have a postcss.config.json file, fix that. The most basic file appears to be

module.exports = {
    plugins: []
}

Restart your server, reload your page, and check the server log. There should be only one request being reported as processed.

Very late to the party, but hope this helps someone. I was temporarily stumped in a trivial Rails 6.1.4.1 app seeing the log.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文