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

Fix wrong call hook #3040

Merged
merged 6 commits into from
Dec 21, 2024
Merged

Conversation

qixing-jk
Copy link
Contributor

尽量按此模板PR内容,或粘贴相关的ISSUE链接。

已知问题

  1. 在react渲染部分调用siteConfig使用useGlobal钩子进行了hook调用,违反了react hook原则
    https://react.dev/warnings/invalid-hook-call-warning

解决方案

  1. 只在组件顶部进行siteConfig调用

改动收益

  1. 更加好的react hook使用,避免未知的错误

具体改动

  1. 多个文件修改
    • 移除原有的渲染代码中siteConfig调用
    • 只在组件顶部进行siteConfig调用

测试确认

  • 本地开发环境测试通过
  • 生产环境构建测试通过
  • 版本号正确显示
  • 环境变量配置正常工作

Copy link

vercel bot commented Dec 3, 2024

@qixing-jk is attempting to deploy a commit to the tangly1024's projects Team on Vercel.

A member of the Team first needs to authorize it.

@tangly1024
Copy link
Owner

感谢您的付出!

@tangly1024 tangly1024 merged commit 2ccaf73 into tangly1024:main Dec 21, 2024
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants