fix: SSR hydration error caused by useId #12719
Open
+13
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting a pull request, please read the contributing guide.
在提交 pull request 之前,请阅读 贡献指南。
目前使用Vite5的SSR项目都可能会出现:刷新后 服务端的id一直自增,而客户端从0开始而引起水合错误 (如:#12548)
这个PR是让SSR用户注入一个初始值,以避免服务端id一直自增
我原本是想将
ID_INJECTION_KEY
导出为一个Symbol()
,但这和当前的构建冲突,这需要你的建议