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

Revert "chore(deps-dev): bump react from 18.3.1 to 19.0.0" #433

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"rc-footer": "^0.6.8",
"rc-resize-observer": "^1.4.0",
"rc-virtual-list": "^3.14.5",
"react": "^19.0.0",
"react": "^18.3.1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting the React version from 19.0.0 to 18.3.1 may be necessary due to compatibility issues with other dependencies or stability concerns. Ensure that all dependent packages are compatible with React 18.3.1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

建议更新相关的类型定义

注意到 @types/react@types/react-dom 仍然保持在 19.0.2 版本。建议同步更新这些类型定义以匹配回退后的 React 版本。

-    "@types/react": "^19.0.2",
+    "@types/react": "^18.2.0",
-    "@types/react-dom": "^19.0.2",
+    "@types/react-dom": "^18.2.0",

Also applies to: 230-230, 108-108


💡 Codebase verification

注意 React 版本不匹配问题

经过验证,发现以下问题:

  • package.json 中声明的 React 版本是 18.3.1,但在构建站点时使用的是 18.3.0-canary 预发布版本
  • 项目中使用的 React API(如 useId、自定义的 useSyncState)都是稳定的 API,没有使用实验性的新特性
  • 不同版本的 React 混用可能会导致不可预知的问题

建议:

  • 统一使用稳定版本 18.3.1,移除 scripts.site 中对预发布版本的临时安装
  • 或者将 package.json 中的版本改为与构建脚本一致的 18.3.0-canary 版本
🔗 Analysis chain

验证开发环境的兼容性

注意到 scripts.site 命令中使用了 React 18.3.0 的预发布版本。建议确认这个预发布版本是否与回退后的 18.3.1 版本兼容。

Also applies to: 230-230, 74-74

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查项目中是否存在使用了 React 19 特性的代码
rg -l "use(Sync|Transition|Deferred|Id|Optimistic)" 

Length of output: 204


Script:

#!/bin/bash
# 检查具体的 React Hook 使用情况
rg "use(Sync|Transition|Deferred|Id|Optimistic)" -A 2

# 检查 package.json 中的相关配置
cat package.json | jq '.scripts.site'

Length of output: 2993

"react-copy-to-clipboard": "^5.1.0",
"react-countup": "^6.5.3",
"react-dom": "^18.3.1",
Expand Down
Loading