🤯 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
💄 style(linear-sync): only spin the main half of a running sync rule's split button (#22265)
Rdmclin2a8aaf60e900b
diff --git a/src/features/Projects/LinearSync/SyncRules.test.tsx b/src/features/Projects/LinearSync/SyncRules.test.tsxnew file mode 100644index 00000000000..a58839c9cf5--- /dev/null+++ b/src/features/Projects/LinearSync/SyncRules.test.tsx@@ -0,0 +1,66 @@+import { render, screen } from '@testing-library/react';+import { SWRConfig } from 'swr';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import SyncRules from './SyncRules';++const linearServiceMocks = vi.hoisted(() => ({+ deleteSyncRule: vi.fn(),+ listSyncRules: vi.fn(),+ startRuleSync: vi.fn(),+}));++vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}));+vi.mock('@/services/linear', () => ({ linearService: linearServiceMocks }));++const rule = {+ connectionId: 'conn-1',+ id: 'rule-1',+ lastRunAt: null,+ linearProjectName: 'Workspace',+ stateTypes: ['backlog'],+ teamName: 'Engineering',+};+const connections = [{ id: 'conn-1', organizationName: 'LobeHub' }] as any;++const renderRules = (jobs: any[]) =>+ render(+ <SWRConfig value={{ dedupingInterval: 0, provider: () => new Map() }}>+ <SyncRules+ connections={connections}+ jobs={jobs}+ projectId={'project-1'}+ onJobStarted={vi.fn()}+ />+ </SWRConfig>,+ );++describe('SyncRules', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ linearServiceMocks.listSyncRules.mockResolvedValue([rule]);+ });++ it('spins only the main half and disables the options half while a rule is running', async () => {+ const { container } = renderRules([{ id: 'job-1', ruleId: 'rule-1', status: 'processing' }]);+ const main = (await screen.findByText('linear.sync.rules.running')).closest('button')!;+ const menu = container.querySelector<HTMLButtonElement>('.lobe-split-button__menu')!;++ expect(main).toHaveAttribute('aria-busy', 'true');+ expect(menu).not.toHaveAttribute('aria-busy');+ expect(menu).toBeDisabled();+ expect(container.querySelectorAll('[aria-busy="true"]')).toHaveLength(1);+ });++ it('keeps both halves idle and enabled when the rule is not running', async () => {+ const { container } = renderRules([]);+ const main = (await screen.findByText('linear.sync.rules.run')).closest('button')!;+ const menu = container.querySelector<HTMLButtonElement>('.lobe-split-button__menu')!;++ expect(main).not.toHaveAttribute('aria-busy');+ expect(main).toBeEnabled();+ expect(menu).toBeEnabled();+ });+});diff --git a/src/features/Projects/LinearSync/SyncRules.tsx b/src/features/Projects/LinearSync/SyncRules.tsxindex 4b7215ab836..220a702df0b 100644--- a/src/features/Projects/LinearSync/SyncRules.tsx+++ b/src/features/Projects/LinearSync/SyncRules.tsx@@ -146,6 +146,7 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, proje{rules.map((rule, index) => {// A disconnected workspace's rule can still be deleted, not run.const disconnected = !organizationOf(rule);+ const running = starting === rule.id || runningRuleIds.has(rule.id);return (<Flexboxhorizontal@@ -174,13 +175,12 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, proje].join(' · ')}</Text></Flexbox>- <SplitButton- disabled={isViewer || disconnected}- loading={starting === rule.id || runningRuleIds.has(rule.id)}- size={'small'}- >+ {/* Only the main half spins while running; the options half just+ turns disabled (SplitButton-level `loading` spins both halves). */}+ <SplitButton disabled={isViewer || disconnected} size={'small'}><SplitButton.Mainicon={<Icon icon={RefreshCwIcon} />}+ loading={running}title={viewerHint ?? (disconnected ? t('linear.sync.rules.disconnected') : undefined)}@@ -190,7 +190,11 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, proje? t('linear.sync.rules.running'): t('linear.sync.rules.run')}</SplitButton.Main>- <SplitButton.Menu items={optionItems} placement={'bottomRight'} />+ <SplitButton.Menu+ disabled={running}+ items={optionItems}+ placement={'bottomRight'}+ /></SplitButton><ActionIcondisabled={isViewer || runningRuleIds.has(rule.id)}