🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(tasks): land the workspace task page on My tasks (#23522)
YuTengjingb3781352ca55
diff --git a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.test.ts b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.test.tsindex a28b635c9b3..6af540d5735 100644--- a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.test.ts+++ b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.test.ts@@ -14,6 +14,7 @@ import {resolveMyTaskScope,resolveTaskCollection,resolveTaskCollectionView,+ taskCollectionParam,} from './AgentTasksPage';import {collapseSubTasks,@@ -231,6 +232,33 @@ describe('AgentTasksPage', () => {expect(resolveTaskCollection(new URLSearchParams('collection=unknown'))).toBe('tasks');});+ it('lands on "My tasks" where the tab is offered', () => {+ expect(resolveTaskCollection(new URLSearchParams(), { allowMine: true })).toBe('mine');+ expect(+ resolveTaskCollection(new URLSearchParams('collection=all'), { allowMine: true }),+ ).toBe('tasks');+ // Links written before "My tasks" became the default still open the ordinary list.+ expect(+ resolveTaskCollection(new URLSearchParams('collection=tasks'), { allowMine: true }),+ ).toBe('tasks');+ expect(+ resolveTaskCollection(new URLSearchParams('collection=scheduled'), { allowMine: true }),+ ).toBe('scheduled');+ });++ it('round-trips every tab through its URL param', () => {+ for (const allowMine of [true, false]) {+ const tabs = allowMine+ ? (['mine', 'tasks', 'scheduled'] as const)+ : (['tasks', 'scheduled'] as const);+ for (const tab of tabs) {+ const param = taskCollectionParam(tab, { allowMine });+ const params = new URLSearchParams(param ? { collection: param } : {});+ expect(resolveTaskCollection(params, { allowMine })).toBe(tab);+ }+ }+ });+it('opens "My tasks" only where the tab is offered', () => {const params = new URLSearchParams('collection=mine');expect(resolveTaskCollection(params, { allowMine: true })).toBe('mine');diff --git a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsxindex d805a256e47..62b2630f5f3 100644--- a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx+++ b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx@@ -143,16 +143,33 @@ export type TaskCollection = 'mine' | 'scheduled' | 'tasks';export type MyTaskScope = 'assigned' | 'created';const COLLECTION_PAGE_SIZE = TASK_COLLECTION_PAGE_SIZE;+/**+ * Where "My tasks" is offered it is the landing tab, so the bare URL opens it and+ * the ordinary list is addressed as `collection=all` (`collection=tasks` keeps+ * resolving for older links). Scopes without the tab keep the ordinary list as+ * their bare URL.+ */export const resolveTaskCollection = (searchParams: URLSearchParams,options: { allowMine?: boolean } = {},): TaskCollection => {const value = searchParams.get('collection');if (value === 'scheduled') return 'scheduled';+ if (value === 'all' || value === 'tasks') return 'tasks';// The "My tasks" tab is only offered where member assignment exists; a deep// link into it from a scope without the tab falls back to ordinary tasks.- if (value === 'mine' && options.allowMine) return 'mine';- return 'tasks';+ if (!options.allowMine) return 'tasks';+ return value === 'mine' || !value ? 'mine' : 'tasks';+};++/** The `collection` search param that addresses a tab; `undefined` is the bare URL. */+export const taskCollectionParam = (+ collection: TaskCollection,+ options: { allowMine?: boolean } = {},+): string | undefined => {+ if (collection === 'scheduled') return 'scheduled';+ if (!options.allowMine) return undefined;+ return collection === 'mine' ? undefined : 'all';};export const resolveMyTaskScope = (searchParams: URLSearchParams): MyTaskScope =>@@ -446,7 +463,8 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, proj);const handleCreateTask = useCallback(() => {- if (createActionBehavior.mode === 'inline') {+ // "My tasks" renders no inline entry to expand, so it always opens the modal.+ if (createActionBehavior.mode === 'inline' && !isMineCollection) {updateSystemStatus({ taskCreateInlineCollapsed: false }, 'expandTaskCreateInline');return;}@@ -456,6 +474,8 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, projagentId,lockAssignee: !!agentId,projectId,+ // Docking would close the modal into an inline entry "My tasks" never renders.+ showInlineToggle: !isMineCollection,onCreated: (task) => {navigate(taskDetailPath(task.identifier, agentId ? task.agentId : undefined, task.name), {state: { taskListOrigin },@@ -466,6 +486,7 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, projagentId,canCreateTask,createActionBehavior.mode,+ isMineCollection,navigate,projectId,taskListOrigin,@@ -506,8 +527,11 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, projconst handleCollectionChange = useCallback((value: string) => {const next = new URLSearchParams(searchParams);- if (value === 'scheduled' || value === 'mine') {- next.set('collection', value);+ const param = taskCollectionParam(value as TaskCollection, {+ allowMine: showMineCollection,+ });+ if (param) {+ next.set('collection', param);} else {next.delete('collection');}@@ -516,7 +540,7 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, projsetCollectionPage(1);setSearchParams(next, { replace: true });},- [searchParams, setSearchParams],+ [searchParams, setSearchParams, showMineCollection],);const handleMyTaskScopeChange = useCallback(@@ -554,9 +578,13 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, proj<TabsRoot size={'small'} value={collection} onValueChange={handleCollectionChange}><TabsList><TabsIndicator />- <TabsTab value={'tasks'}>{t('taskList.title')}</TabsTab>- <TabsTab value={'scheduled'}>{t('taskList.scheduled.title')}</TabsTab>+ {/* The landing tab leads; beside "My tasks" the ordinary list needs a+ scope in its name, or it reads as the page title. */}{showMineCollection && <TabsTab value={'mine'}>{t('taskList.mine.title')}</TabsTab>}+ <TabsTab value={'tasks'}>+ {showMineCollection ? t('taskList.all') : t('taskList.title')}+ </TabsTab>+ <TabsTab value={'scheduled'}>{t('taskList.scheduled.title')}</TabsTab></TabsList></TabsRoot>{isMineCollection && (@@ -593,6 +621,16 @@ const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId, headerActions, projonClick={handleCreateTask}/>)}+ {isMineCollection && (+ <ActionIcon+ aria-label={t('createTask.submit')}+ disabled={!canCreateTask}+ icon={Plus}+ size={headerActionSmallSize}+ title={canCreateTask ? t('createTask.submit') : reason}+ onClick={handleCreateTask}+ />+ )}{isScheduledCollection && !showScheduledEmptyCreate && (<ActionIcondisabled={!canCreateTask}