fix(frontend): fix multiple UI bugs and improve robustness#2664
Open
zhoufengen wants to merge 1 commit intobytedance:mainfrom
Open
fix(frontend): fix multiple UI bugs and improve robustness#2664zhoufengen wants to merge 1 commit intobytedance:mainfrom
zhoufengen wants to merge 1 commit intobytedance:mainfrom
Conversation
- Add null guard in useRenameThread to prevent runtime crash when query cache is empty, matching existing pattern in useDeleteThread - Check response.ok in loadArtifactContent before reading body to avoid displaying error HTML as artifact content - Handle clipboard API failure in CopyButton to avoid showing false "copied" state - Replace invalid ARIA roles with data attributes in message skeleton - Fix TodoList dark mode by replacing hardcoded bg-white with theme aware class - Remove console.log statements from production code paths Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Collaborator
|
@zhoufengen, thanks for your contribution. Please fix the lint error. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses several small but user-visible frontend issues in the DeerFlow workspace UI and core client utilities, improving robustness and accessibility while removing stray debug logging.
Changes:
- Hardened React Query cache updates (null/undefined guards) and artifact loading (response.ok check).
- Improved clipboard copy UX by awaiting clipboard writes before showing the “copied” state.
- Fixed UI/accessibility issues (dark-mode background class; replaced invalid ARIA roles with data attributes) and removed production
console.logs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/core/threads/hooks.ts | Prevents potential crash when renaming if cached thread list is missing/undefined. |
| frontend/src/core/config/index.ts | Removes debug logging from base URL resolution. |
| frontend/src/core/artifacts/loader.ts | Throws a descriptive error when artifact fetch fails instead of treating error HTML as content. |
| frontend/src/core/api/api-client.ts | Removes debug logging during API client creation. |
| frontend/src/components/workspace/todo-list.tsx | Uses theme-aware bg-background to support dark mode. |
| frontend/src/components/workspace/messages/skeleton.tsx | Replaces invalid role values with data-role attributes to avoid ARIA violations. |
| frontend/src/components/workspace/copy-button.tsx | Awaits clipboard write and only shows “copied” state on success. |
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.
Summary
This PR fixes several frontend bugs and improves code robustness across the workspace components and core modules.
Changes
Bug Fixes
Null guard in
useRenameThread(core/threads/hooks.ts)onSuccesscallback calledoldData.map()without checking for null, which would crash if the query cache was empty.if (oldData == null) { return oldData; }guard already used inuseDeleteThread.Response check in
loadArtifactContent(core/artifacts/loader.ts)fetch()result was read withresponse.text()without checkingresponse.ok, which could display error HTML as artifact content.if (!response.ok)check that throws a descriptive error.Clipboard API error handling in
CopyButton(components/workspace/copy-button.tsx)navigator.clipboard.writeText()was fire-and-forget (void), so the "copied" indicator would show even if the write failed.Accessibility
components/workspace/messages/skeleton.tsx)role="human-message"androle="assistant-message"are not valid WAI-ARIA role values.data-roleattributes to preserve the semantic intent without violating the spec.UI
TodoList(components/workspace/todo-list.tsx)bg-whitebroke dark mode rendering.bg-background, the theme-aware class used throughout the workspace.Code Quality
console.logfrom production code (core/config/index.ts,core/api/api-client.ts)console.logstatements that would output to the browser console in production.Testing