feat(chat): support render empty prompt#575
Merged
LuckyFBB merged 2 commits intoDTStack:masterfrom Jun 30, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new feature to support rendering an empty prompt and optimizes the rendering behavior for both typing effects and markdown content, particularly to avoid HTML splitting and validateDOMNesting issues.
- Introduces a helper function in the typing effect to ensure HTML tags aren’t split.
- Adds a guard to the prompt component to return null when no title is provided.
- Modifies the markdown rendering to conditionally use a div element to prevent DOM nesting errors.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/useTyping/index.ts | Adds a helper function to calculate the next chunk position without splitting HTML tags. |
| src/chat/prompt/index.tsx | Returns null for empty prompts based on a missing title field. |
| src/chat/markdown/index.tsx | Adjusts paragraph rendering to avoid validateDOMNesting errors with non-text children. |
Comments suppressed due to low confidence (2)
src/chat/prompt/index.tsx:31
- [nitpick] Consider adding a comment here to clarify why the component returns null when 'data.title' is missing, helping maintain readability and understandability of the logic.
if (!data?.title) return null;
src/chat/markdown/index.tsx:51
- [nitpick] While the conditional rendering prevents validateDOMNesting errors, verify that using a instead of a
for mixed content does not affect the intended semantics or accessibility of the output.
p: (data) => {
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 的类型:
相关问题
变更内容
详细描述
对应 Previewer