Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议默认关闭 HTML 分块传输 #7038

Closed
3 tasks done
ruibaby opened this issue Nov 15, 2024 · 4 comments
Closed
3 tasks done

建议默认关闭 HTML 分块传输 #7038

ruibaby opened this issue Nov 15, 2024 · 4 comments
Labels
area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@ruibaby
Copy link
Member

ruibaby commented Nov 15, 2024

前置条件

  • 已经在 Issues 列表中搜索了相关问题。
  • 这是和 Halo 相关的特性,如果是非项目本身的问题,建议在 Discussions 提交。
  • 如果是插件和主题特性建议,请在对应的插件和主题仓库提交。

你当前使用的版本

2.20.9

描述一下此特性

原因可见:halo-dev/theme-earth#209

目前尚不清楚其他主题是否也有此问题,但理论上页面只要有左右响应式布局都可能遇到此问题,并且这个问题可能对主题开发者造成困扰,所以建议默认关闭。

/area core
/kind improvement

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. labels Nov 15, 2024
@JohnNiang
Copy link
Member

IMO,分块传输只会影响 首字节到达时间(TTFB),理论上并不会应行到样式的 CLS。目前我查阅过官方文档和对应的优化方案,都没有提到 HTTP 传输会对它造成影响。

另外,我尝试通过配置 --spring.thymeleaf.reactive.max-chunk-size=0 禁用分块传输,并使用主题 theme-earth#1.11.1 进行测试,问题仍然存在。

/triage needs-information

@f2c-ci-robot f2c-ci-robot bot added the triage/needs-information Indicates an issue needs more information in order to work on it. label Nov 19, 2024
@ruibaby
Copy link
Member Author

ruibaby commented Nov 19, 2024

我也没有找到资料能够直接表明开启分块传输可能造成这个问题,但请尝试访问下面的地址,并对比区别:

以下对比组网站完全一致,区别只有开启和关闭分块传输。

开启

Earth 主题

Joe 3 主题

关闭(--spring.thymeleaf.reactive.max-chunk-size=0)

Earth 主题

Joe 3 主题

@ruibaby
Copy link
Member Author

ruibaby commented Nov 19, 2024

需要注意的是,这个问题确实可能和浏览器解析 DOM 树和解析 CSS 的行为有关,但明显开启分块传输之后会让问题出现或者更明显。

@JohnNiang
Copy link
Member

从我实际体验来看,两者区别不大,可能是我这里访问起来都很慢的缘故。

分块传输无疑是让 CLS 暴露得更明显了而已,但这并不是说明是分块传输导致的 CLS 问题。值得注意的是,它可以提高 TTFB 的分数。

建议主题作者参考官方优化文档进行优化 CLS 问题。

@ruibaby ruibaby closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants