-
Notifications
You must be signed in to change notification settings - Fork 125
fix(wework): support project task round-trip navigation #2415
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ import type { | |
| } from '@/api/deliveries' | ||
| import type { AITableApi } from '@/api/aitable' | ||
| import type { WorkbenchServices } from '@/features/workbench/workbenchServices' | ||
| import type { RuntimeTaskAddress } from '@/types/api' | ||
| import { cn } from '@/lib/utils' | ||
| import { TaskDescriptionEditor } from './TaskDescriptionEditor' | ||
| import { TagEditor } from './TagEditor' | ||
|
|
@@ -235,14 +236,15 @@ export type TodoEditorProps = { | |
| aitableApi?: AITableApi | ||
| allItems: CloudLoopItem[] | ||
| onClose: () => void | ||
| onOpenRuntimeTask?: (address: RuntimeTaskAddress) => Promise<void> | void | ||
| } & (TodoEditorCreateProps | TodoEditorEditProps) | ||
|
|
||
| // Single panel for creating, viewing, and editing a todo. Create mode keeps a | ||
| // local draft and stages attachments until the item exists; edit mode loads the | ||
| // sections that require an item id (children, collaborators, executions, | ||
| // deliveries) and saves through a versioned update. | ||
| export function TodoEditor(props: TodoEditorProps) { | ||
| const { api, allItems, onClose } = props | ||
| const { api, allItems, onClose, onOpenRuntimeTask } = props | ||
| const createProps = props.mode === 'create' ? props : null | ||
| const editProps = props.mode === 'edit' ? props : null | ||
| const isCreate = createProps !== null | ||
|
|
@@ -1024,9 +1026,19 @@ export function TodoEditor(props: TodoEditorProps) { | |
| ) : ( | ||
| <div className="mt-1"> | ||
| {tasks.map(task => ( | ||
| <div | ||
| <button | ||
| key={task.id} | ||
| className="flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-xs transition-colors hover:bg-muted/60" | ||
| type="button" | ||
| data-testid={`cloud-todo-execution-${task.id}`} | ||
| onClick={() => | ||
| void onOpenRuntimeTask?.({ | ||
| deviceId: task.device_id, | ||
| taskId: task.task_id, | ||
| }) | ||
| } | ||
| disabled={!onOpenRuntimeTask} | ||
| className="flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus disabled:cursor-default" | ||
| aria-label={`打开本地执行 ${task.task_title || task.task_id}`} | ||
|
Comment on lines
+1029
to
+1041
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Provide a 44px mobile touch target. This new local-execution button is about 32px high from its text and Add a 44px minimum height for mobile. Preserve the compact height at desktop only if needed. 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| > | ||
| <Link2 className="h-4 w-4 shrink-0 text-text-muted" /> | ||
| <span | ||
|
|
@@ -1036,7 +1048,7 @@ export function TodoEditor(props: TodoEditorProps) { | |
| {task.task_title || task.task_id} | ||
| </span> | ||
| <span className="shrink-0 text-text-muted">{task.device_id}</span> | ||
| </div> | ||
| </button> | ||
| ))} | ||
| </div> | ||
| )} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: wecode-ai/Wegent
Length of output: 4401
🌐 Web query:
React Strict Mode double invokes effects setup cleanup before second setup documentation💡 Result:
In React Strict Mode (development only), React intentionally performs an extra mount-unmount-remount cycle to verify that your components and effects are resilient and properly handle setup and cleanup [1][2][3]. The specific sequence of execution in Strict Mode for a component mount is: 1. Setup (First mount) [3] 2. Cleanup (First unmount) [3] 3. Setup (Second mount) [3] This behavior was introduced in React 18 to help developers identify bugs caused by missing cleanup functions or impure logic [2][4]. Because Effects are expected to be synchronized with the component's lifecycle, they should always have a cleanup function if they perform side effects (like subscriptions, network requests, or timers) [1][2]. When your component mounts in development, this sequence runs: - React calls your Effect's setup code [1]. - React immediately runs your Effect's cleanup function [1][3]. - React calls your Effect's setup code again [1]. This cycle ensures that if your code has a bug—such as a missing cleanup function that leaves an event listener or a WebSocket connection open—you will notice the issue immediately in development [1][2]. In production builds, Strict Mode checks are stripped out, and the component mounts exactly once [2][3]. If you are concerned about side effects occurring twice (e.g., duplicate API requests), the recommended approach is to implement proper cleanup (such as using an AbortController to cancel fetches or a boolean flag to ignore results) rather than disabling Strict Mode [4][5][3]. Top results: [1][2][3]
Citations:
Set
focusedItemRequestRefafter the active microtask guard.React Strict Mode can run setup, cleanup, then setup again before the queued microtask. The first cleanup sets
activetofalse, and the second setup exits atfocusedItemRequestRef.current === requestKey, so the focused task does not open andonFocusedItemHandledis not called. Move the ref update into the microtask after the!activereturn.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents