fix(types): declare disablePrerender on StandardProps#19411
Open
xiangnuans wants to merge 1 commit into
Open
Conversation
The prerender runtime reads `disablePrerender` off element props
(packages/taro-webpack5-runner/src/prerender/prerender.ts), but the type
was never declared on `StandardProps`, so setting it on any component
(e.g. `<View disablePrerender />`) raised a TS error:
Property 'disablePrerender' does not exist on type
'IntrinsicAttributes & ViewProps'.
Add it as an optional boolean on `StandardProps` (the base props shared by
all components), matching the runtime that reads it off any element.
Fixes NervJS#19029
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough在 Changes类型定义补充
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
这个 PR 做了什么? (简要描述所做更改)
为公共组件属性类型
StandardProps补充disablePrerender?: boolean声明。预渲染运行时 (
packages/taro-webpack5-runner/src/prerender/prerender.ts) 会读取元素上的disablePrerender属性来跳过该节点的预渲染,但该属性从未在StandardProps上声明,导致在任意组件上使用(如<View disablePrerender />)时报 TS 错误:由于该属性作用于任意元素,故加在所有组件共享的基类型
StandardProps上,与运行时行为一致。这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Fixes #19029
Summary by CodeRabbit
StandardProps新增可选属性disablePrerender,可用于在预渲染过程中跳过当前节点。