[v11] Tabs: Error when SSRing in Next.js
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nextjs, react
- 领域
- frontend
调研方向
首先在本地运行链接的 nextjs-quickstart-nextgen 复现项目并检查 app/page.tsx,将失败的 SSR 设置与启用 "use client" 的版本进行比较。跟踪 Tabs 组件的使用情况,并验证页面在 SSR 期间渲染时不会出现无效元素错误,同时保留预期的客户端行为。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Love the project! Very helpful :)
With v11 alpha.7 (I'm guessing earlier versions too, that's just the only one I tested) you get an error in the browser when trying to use the Tabs component in a page that is SSR.
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I followed this guide to setup up ReactPrime in my project: https://v11.primereact.org/docs/installation/nextjs
This might apply to other components too. I haven't tried many yet.
Reproducer
https://stackblitz.com/edit/stackblitz-starters-7lommp8z
System Information
System:
OS: macOS 15.6.1
CPU: (10) arm64 Apple M2 Pro
Memory: 1.03 GB / 32.00 GB
Shell: 4.0.2 - /opt/homebrew/bin/fish
Binaries:
Node: 20.19.4 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.8.2 - /opt/homebrew/bin/npm
Deno: 2.4.5 - /opt/homebrew/bin/deno
Browsers:
Chrome: 142.0.7444.135
Edge: 142.0.3595.65
Firefox: 145.0
Safari: 26.1
npmPackages:
primereact: ^11.0.0-alpha.7 => 11.0.0-alpha.7
react: 19.2.0 => 19.2.0
tailwindcss: ^4 => 4.1.17
Steps to reproduce the behavior
-
Download and run the stackblitz project. I couldn't get it to actually run in stackbliz in the browser due to issues with next.js's turbopack and wasm but if you download the project and run it locally it should work. The project is just https://github.com/primefaces/primereact-examples/tree/main/nextjs-quickstart-nextgen that is linked to from https://v11.primereact.org/docs/installation/nextjs and has been updated to the latest version of prime react v11 and nextjs + the Tabs component added and
"use client;"commented out. -
Observe the error
-
Uncomment
"use client;"in app/page.tsx -
Observe that the error goes away.
Expected behavior
No error to occur.
- 主要语言
- CSS
- 星标
- 8.3k
- 派生
- 1.2k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
primefaces/primereact 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
primefaces/primereact#8552 ·
-
难度 1/5 1-3 小时 新手友好度 88/100
primefaces/primereact#8550 ·
-
Row checkbox selection tick is invisible in Landing Page Theme section可能已有人在做 @Prakash1185 于 173 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
primefaces/primereact#8545 ·
-
Dependency conflict between jspdf v4 and jspdf-autotable during npm install可能已有人在做 @Kamran92 于 187 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
primefaces/primereact#8537 ·
-
难度 3/5 1-2 天 新手友好度 58/100
primefaces/primereact#8551 ·
查看 primefaces/primereact 的全部 Issue
相似的 Issue
-
[BUG]: Shared links drop the configured basePath on GitHub Pages可能已有人在做 @anshulchikhale30-p 今天认领。 未关闭bug
难度 1/5 1 小时以内 新手友好度 88/100
StabilityNexus/IdentityTokens-EVM-Frontend#182 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1 小时以内 新手友好度 82/100
Leonxlnx/taste-skill#216 ·
维护者通常 1 天内回复
-
area: ui Bug Payload OSS
难度 1/5 1 小时以内 新手友好度 88/100
payloadcms/payload#19839 ·
维护者通常 1 天内回复
-
BoxShadow.lerp returns the wrong blur style at t = 0 or t = 1可能已有人在做 @ArtemChikolaev 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复