Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(databases): skip the empty webhook creation step (#9168)
Wolf Mermelstein053638bbf5d1
diff --git a/RESULT.json b/RESULT.jsonnew file mode 100644index 0000000000..f13f230403--- /dev/null+++ b/RESULT.json@@ -0,0 +1,47 @@+{+ "status": "blocked",+ "summary": "Implementation and review fixes are complete, pushed, audited, and CI is green. Appending the PR tracking section to the Macro task remains blocked by authentication.",+ "task_id": "01a1792e-7744-7f48-9367-959546cb7cdb",+ "pr_url": "https://github.com/macro-inc/macro/pull/9168",+ "head_commit": "83e7ed3f27c5b99d0b85cf4e02f48ff492f35968",+ "pr_state": "OPEN",+ "ready_for_review": true,+ "mergeable": true,+ "merged": false,+ "validation": {+ "database_tests": {+ "files_passed": 34,+ "tests_passed": 148+ },+ "browser_tests": {+ "passed": 2,+ "surfaces": [+ "desktop",+ "phone"+ ],+ "browser": "own headless Chromium"+ },+ "typecheck": "passed",+ "just_check": "passed",+ "privacy": "passed",+ "auditor": "passed",+ "ci": {+ "status": "passed",+ "passed": 22,+ "skipped": 13,+ "failed": 0,+ "pending": 0+ },+ "live_backend_trace": "not verified; browser tests use local fixtures"+ },+ "task_status": "In Progress (set in prior execution)",+ "task_tracking_updated": false,+ "blockers": [+ {+ "step": "Append Agent tracking section to Macro task using SDK",+ "error": "Macro MCP ExecuteCode request returns HTTP 401 Unauthorized; production OAuth credential has no refresh token.",+ "required_action": "Restore Macro authentication, then append the tracking section without rewriting the existing task body."+ }+ ],+ "verified_at": "2026-10-30T01:40:10.061688+00:00"+}diff --git a/apps/web/src/features/block-database/browser-test/webhooks.browser.e2e.ts b/apps/web/src/features/block-database/browser-test/webhooks.browser.e2e.tsnew file mode 100644index 0000000000..ee6c7d3e0b--- /dev/null+++ b/apps/web/src/features/block-database/browser-test/webhooks.browser.e2e.ts@@ -0,0 +1,57 @@+import { expect, test } from '@playwright/test';++for (const mobile of [false, true]) {+ test(`webhooks skip the empty step and preserve management (${mobile ? 'phone' : 'desktop'})`, async ({+ browser,+ }) => {+ const context = await browser.newContext({+ viewport: mobile+ ? { width: 390, height: 844 }+ : { width: 1280, height: 800 },+ isMobile: mobile,+ hasTouch: mobile,+ permissions: ['clipboard-read', 'clipboard-write'],+ });+ const page = await context.newPage();+ await page.route('https://**', (route) => route.abort());+ await page.route('**/__macro_dev/**', (route) => route.abort());+ await page.goto(+ 'http://localhost:' ++ (process.env.DATABASE_TABLE_TEST_PORT ?? '3005') ++ '/src/features/block-database/browser-test/webhooks.html',+ { waitUntil: 'domcontentloaded' }+ );+ const opener = page.getByRole('button', { name: 'Webhooks', exact: true });+ await opener.click();+ const url = page.getByRole('textbox');+ await expect(url).toHaveValue(/example-token-1$/);+ await expect(page.getByLabel('Creations')).toHaveText('1');+ await page.getByRole('button', { name: 'Copy webhook URL' }).click();+ expect(await page.evaluate(() => navigator.clipboard.readText())).toMatch(+ /example-token-1$/+ );+ await page.screenshot({ path: test.info().outputPath('webhooks.png') });+ await page.getByRole('button', { name: 'Done', exact: true }).click();+ await expect(opener).toBeFocused();+ await opener.click();+ await expect(+ page.getByRole('button', { name: 'Delete webhook' })+ ).toHaveCount(1);+ await expect(page.getByLabel('Creations')).toHaveText('1');+ await page+ .getByRole('button', { name: 'Create webhook', exact: true })+ .click();+ await expect(url).toHaveValue(/example-token-2$/);+ await expect(+ page.getByRole('button', { name: 'Delete webhook' })+ ).toHaveCount(2);+ await page.getByRole('button', { name: 'Delete webhook' }).last().click();+ await expect(url).toHaveCount(0);+ await page.getByRole('button', { name: 'Delete webhook' }).click();+ await expect(+ page.getByRole('button', { name: 'Delete webhook' })+ ).toHaveCount(0);+ await expect(page.getByLabel('Creations')).toHaveText('2');+ await context.close();+ });+}diff --git a/apps/web/src/features/block-database/browser-test/webhooks.html b/apps/web/src/features/block-database/browser-test/webhooks.htmlnew file mode 100644index 0000000000..11ced131a8--- /dev/null+++ b/apps/web/src/features/block-database/browser-test/webhooks.html@@ -0,0 +1,5 @@+<!doctype html>+<html lang="en">+ <head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Database webhook regression</title></head>+ <body><div id="root"></div><script type="module" src="./webhooks.tsx"></script></body>+</html>diff --git a/apps/web/src/features/block-database/browser-test/webhooks.tsx b/apps/web/src/features/block-database/browser-test/webhooks.tsxnew file mode 100644index 0000000000..7b9f3f99a4--- /dev/null+++ b/apps/web/src/features/block-database/browser-test/webhooks.tsx@@ -0,0 +1,67 @@+import '@app/index.css';+import { queryClient } from '@queries/client';+import { storageServiceClient } from '@service-storage/client';+import type { DatabaseWebhookResponse } from '@service-storage/generated/schemas/databaseWebhookResponse';+import type { TableDetail } from '@service-storage/generated/schemas/tableDetail';+import { QueryClientProvider } from '@tanstack/solid-query';+import { Button } from '@ui/components/Button';+import { okAsync } from 'neverthrow';+import { createSignal, Show } from 'solid-js';+import { render } from 'solid-js/web';+import { WebhooksDialog } from '../component/WebhooksDialog';++const table: TableDetail = {+ table: {+ id: 'table',+ database_id: 'database',+ name: 'Contacts',+ position: 'a',+ version: 1,+ },+ columns: [],+ views: [],+ sql_name: '"Contacts"',+};+let webhooks: DatabaseWebhookResponse[] = [];+const [creations, setCreations] = createSignal(0);+storageServiceClient.databases.listWebhooks = () =>+ okAsync({ webhooks: [...webhooks] });+storageServiceClient.databases.createWebhook = () => {+ setCreations((count) => count + 1);+ const webhook: DatabaseWebhookResponse = {+ id: `webhook-${creations()}`,+ databaseId: 'database',+ tableId: 'table',+ createdBy: 'user',+ createdAt: '2026-01-01T00:00:00Z',+ tokenPrefix: `example-${creations()}`,+ };+ webhooks.push(webhook);+ return okAsync({ webhook, token: `example-token-${creations()}` });+};+storageServiceClient.databases.deleteWebhook = ({ webhookId }) => {+ webhooks = webhooks.filter((webhook) => webhook.id !== webhookId);+ return okAsync({});+};+function Fixture() {+ const [open, setOpen] = createSignal(false);+ let opener: HTMLButtonElement | undefined;+ return (+ <QueryClientProvider client={queryClient}>+ <Button ref={opener} onClick={() => setOpen(true)}>+ Webhooks+ </Button>+ <output aria-label="Creations">{creations()}</output>+ <Show when={open()}>+ <WebhooksDialog+ databaseId="database"+ table={table}+ onClose={() => setOpen(false)}+ returnFocus={opener}+ />+ </Show>+ </QueryClientProvider>+ );+}+const root = document.getElementById('root');+if (root) render(() => <Fixture />, root);diff --git a/apps/web/src/features/block-database/component/WebhooksDialog.test.tsx b/apps/web/src/features/block-database/component/WebhooksDialog.test.tsxnew file mode 100644index 0000000000..f1ecd7259e--- /dev/null+++ b/apps/web/src/features/block-database/component/WebhooksDialog.test.tsx@@ -0,0 +1,206 @@+import { queryClient } from '@queries/client';+import type { DatabaseWebhookResponse } from '@service-storage/generated/schemas/databaseWebhookResponse';+import type { TableDetail } from '@service-storage/generated/schemas/tableDetail';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { onlineManager, QueryClientProvider } from '@tanstack/solid-query';+import { errAsync, okAsync, ResultAsync } from 'neverthrow';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { toast } from '../../../lib/core/component/Toast/Toast';+import { databaseWebhookKeys } from '../queries/keys';+import { WebhooksDialog } from './WebhooksDialog';++const api = vi.hoisted(() => ({+ list: vi.fn(),+ create: vi.fn(),+ remove: vi.fn(),+}));+vi.mock('@service-storage/client', () => ({+ storageServiceClient: {+ databases: {+ listWebhooks: api.list,+ createWebhook: api.create,+ deleteWebhook: api.remove,+ },+ },+}));+vi.mock('../../../lib/core/component/Toast/Toast', () => ({+ toast: { failure: vi.fn() },+}));+const table: TableDetail = {+ table: {+ id: 'table',+ database_id: 'database',+ name: 'Contacts',+ position: 'a',+ version: 1,+ },+ columns: [],+ views: [],+ sql_name: '"Contacts"',+};+const webhook: DatabaseWebhookResponse = {+ id: 'webhook',+ databaseId: 'database',+ tableId: 'table',+ createdBy: 'user',+ createdAt: '2026-01-01T00:00:00Z',+ tokenPrefix: 'secret',+};+function open() {+ return render(() => (+ <QueryClientProvider client={queryClient}>+ <WebhooksDialog databaseId="database" table={table} onClose={vi.fn()} />+ </QueryClientProvider>+ ));+}+beforeEach(() => {+ queryClient.clear();+ vi.spyOn(window, 'scrollTo').mockImplementation(() => {});+ api.list.mockReset().mockReturnValue(okAsync({ webhooks: [] }));+ api.create+ .mockReset()+ .mockReturnValue(okAsync({ webhook, token: 'secret-token' }));+ api.remove.mockReset().mockReturnValue(okAsync(undefined));+});+afterEach(() => {+ cleanup();+ queryClient.clear();+ vi.restoreAllMocks();+ onlineManager.setOnline(true);+});++it('creates once after the empty list loads and keeps deletion explicit', async () => {+ let loaded!: (value: { webhooks: DatabaseWebhookResponse[] }) => void;+ api.list.mockReturnValue(+ ResultAsync.fromSafePromise(+ new Promise((resolve) => {+ loaded = resolve;+ })+ )+ );+ open();+ expect(api.create).not.toHaveBeenCalled();+ loaded({ webhooks: [] });+ await waitFor(() =>+ expect(api.create).toHaveBeenCalledExactlyOnceWith({+ id: 'database',+ tableId: 'table',+ })+ );+ expect(await screen.findByDisplayValue(/secret-token/)).toBeTruthy();+ fireEvent.click(+ await screen.findByRole('button', { name: 'Delete webhook' })+ );+ await waitFor(() =>+ expect(api.remove).toHaveBeenCalledWith({+ id: 'database',+ webhookId: 'webhook',+ })+ );+ await waitFor(() =>+ expect(screen.queryByDisplayValue(/secret-token/)).toBeNull()+ );+ expect(api.create).toHaveBeenCalledTimes(1);+});+it('opens existing webhooks without creating and allows another explicitly', async () => {+ api.list.mockReturnValue(okAsync({ webhooks: [webhook] }));+ open();+ await screen.findByRole('button', { name: 'Delete webhook' });+ expect(api.create).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole('button', { name: 'Create webhook' }));+ await screen.findByDisplayValue(/secret-token/);+ expect(api.create).toHaveBeenCalledTimes(1);+});+it('allows retrying a failed initial creation without an automatic retry loop', async () => {+ api.create.mockReturnValueOnce(errAsync(new Error('failed')));+ open();+ await waitFor(() =>+ expect(toast.failure).toHaveBeenCalledWith('Could not create a webhook.')+ );+ expect(api.create).toHaveBeenCalledTimes(1);+ fireEvent.click(screen.getByRole('button', { name: 'Create webhook' }));+ await screen.findByDisplayValue(/secret-token/);+ expect(api.create).toHaveBeenCalledTimes(2);+});+it('does not create another webhook when reopening management', async () => {+ api.list.mockReturnValue(okAsync({ webhooks: [webhook] }));+ const first = open();+ await screen.findByRole('button', { name: 'Delete webhook' });+ first.unmount();+ open();+ await screen.findByRole('button', { name: 'Delete webhook' });+ expect(api.create).not.toHaveBeenCalled();+});++it('waits for the server before creating from an empty cached list', async () => {+ queryClient.setQueryData(databaseWebhookKeys.list('database').queryKey, {+ webhooks: [],+ });+ let loaded!: (value: { webhooks: DatabaseWebhookResponse[] }) => void;+ api.list.mockReturnValue(+ ResultAsync.fromSafePromise(+ new Promise((resolve) => {+ loaded = resolve;+ })+ )+ );+ open();+ expect(api.create).not.toHaveBeenCalled();+ loaded({ webhooks: [webhook] });+ await screen.findByRole('button', { name: 'Delete webhook' });+ expect(api.create).not.toHaveBeenCalled();+});++it('keeps the dialog open while the one-time URL is being created', async () => {+ let created!: (value: {+ webhook: DatabaseWebhookResponse;+ token: string;+ }) => void;+ api.create.mockReturnValue(+ ResultAsync.fromSafePromise(+ new Promise((resolve) => {+ created = resolve;+ })+ )+ );+ const close = vi.fn();+ render(() => (+ <QueryClientProvider client={queryClient}>+ <WebhooksDialog databaseId="database" table={table} onClose={close} />+ </QueryClientProvider>+ ));+ await screen.findByRole('button', { name: 'Creating…' });+ const done = screen.getByRole('button', { name: 'Done' });+ expect(done.hasAttribute('disabled')).toBe(true);+ fireEvent.click(done);+ fireEvent.keyDown(document, { key: 'Escape' });+ expect(close).not.toHaveBeenCalled();+ created({ webhook, token: 'secret-token' });+ await screen.findByDisplayValue(/secret-token/);+ fireEvent.click(done);+ expect(close).toHaveBeenCalledOnce();+});++it('waits for a paused offline refetch before automatic creation', async () => {+ onlineManager.setOnline(false);+ queryClient.setQueryData(databaseWebhookKeys.list('database').queryKey, {+ webhooks: [],+ });+ open();+ await waitFor(() =>+ expect(+ queryClient.getQueryState(databaseWebhookKeys.list('database').queryKey)+ ?.fetchStatus+ ).toBe('paused')+ );+ expect(api.create).not.toHaveBeenCalled();+ onlineManager.setOnline(true);+ await screen.findByDisplayValue(/secret-token/);+ expect(api.create).toHaveBeenCalledTimes(1);+});diff --git a/apps/web/src/features/block-database/component/WebhooksDialog.tsx b/apps/web/src/features/block-database/component/WebhooksDialog.tsxindex ef5095b38a..fe34688dac 100644--- a/apps/web/src/features/block-database/component/WebhooksDialog.tsx+++ b/apps/web/src/features/block-database/component/WebhooksDialog.tsx@@ -1,6 +1,7 @@import { fireAndForget } from '@core/util/fireAndForget';import CopyIcon from '@icon/system/regular/copy.svg';import TrashIcon from '@icon/system/regular/trash-simple.svg';+import { Telemetry } from '@macro-inc/observability';import { databaseWebhookUrl } from '@service-storage/databases';import type { DatabaseWebhookResponse } from '@service-storage/generated/schemas/databaseWebhookResponse';import type { TableDetail } from '@service-storage/generated/schemas/tableDetail';@@ -9,7 +10,7 @@ import { CopyButton } from '@ui/components/CopyButton';import { Dialog } from '@ui/components/Dialog';import { Input } from '@ui/components/Input';import { Panel } from '@ui/components/Panel';-import { createSignal, For, Show } from 'solid-js';+import { createEffect, createSignal, For, on, onCleanup, Show } from 'solid-js';import { toast } from '../../../lib/core/component/Toast/Toast';import { toViewColumn } from '../../database/queries/column-detail';import { webhookCurl, webhookExamplePayload } from '../core/webhook-example';@@ -36,12 +37,17 @@ export function WebhooksDialog(props: {onClose: () => void;returnFocus?: HTMLElement;}) {- const { webhooks, failed } = useTableWebhooks(+ const { webhooks, failed, ready } = useTableWebhooks(() => props.databaseId,() => props.table.table.id);const [created, setCreated] = createSignal<CreatedWebhook>();const [pending, setPending] = createSignal(false);+ let initialCreationHandled = false;+ let disposed = false;+ onCleanup(() => {+ disposed = true;+ });const example = () =>webhookExamplePayload(props.table.columns.map(toViewColumn),@@ -50,17 +56,42 @@ export function WebhooksDialog(props: {async function create() {if (pending()) return;+ initialCreationHandled = true;setPending(true);- const result = await createTableWebhook(- props.databaseId,- props.table.table.id+ const databaseId = props.databaseId;+ const tableId = props.table.table.id;+ const result = await Telemetry.span(+ 'database.webhook.create',+ async (span) => {+ span.setAttr('database.id', databaseId);+ span.setAttr('table.id', tableId);+ const result = await createTableWebhook(databaseId, tableId);+ if (result.isErr()) span.error('Could not create a webhook');+ return result;+ });+ if (disposed) return;setPending(false);+ if (props.databaseId !== databaseId || props.table.table.id !== tableId)+ return;result.match(setCreated, () =>toast.failure('Could not create a webhook.'));}+ createEffect(+ on(+ () => (ready() ? webhooks() : undefined),+ (loaded) => {+ if (loaded === undefined || initialCreationHandled) return;+ initialCreationHandled = true;+ if (loaded.length === 0) {+ fireAndForget(create(), 'database-webhooks');+ }+ }+ )+ );+async function remove(webhook: DatabaseWebhookResponse) {const result = await deleteTableWebhook(props.databaseId, webhook.id);result.match(@@ -75,7 +106,7 @@ export function WebhooksDialog(props: {<Dialogopenclass="w-160 max-w-[calc(100vw-2rem)]"- onOpenChange={(open) => !open && props.onClose()}+ onOpenChange={(open) => !open && !pending() && props.onClose()}onCloseAutoFocus={(event) => {if (props.returnFocus?.isConnected) {event.preventDefault();@@ -182,7 +213,12 @@ export function WebhooksDialog(props: {</ul></Show><div class="flex justify-end gap-2">- <Button type="button" variant="ghost" onClick={props.onClose}>+ <Button+ type="button"+ variant="ghost"+ disabled={pending()}+ onClick={props.onClose}+ >Done</Button><Buttondiff --git a/apps/web/src/features/block-database/queries/webhooks.ts b/apps/web/src/features/block-database/queries/webhooks.tsindex 42a0d7f60b..7384564a7c 100644--- a/apps/web/src/features/block-database/queries/webhooks.ts+++ b/apps/web/src/features/block-database/queries/webhooks.ts@@ -13,6 +13,7 @@ import { databaseWebhookKeys } from './keys';function databaseWebhooksQueryOptions(databaseId: string) {return queryOptions({queryKey: databaseWebhookKeys.list(databaseId).queryKey,+ refetchOnMount: 'always',queryFn: () =>throwOnErr(() =>storageServiceClient.databases.listWebhooks({ id: databaseId })@@ -27,6 +28,7 @@ export function useTableWebhooks(): {webhooks: Accessor<DatabaseWebhookResponse[] | undefined>;failed: Accessor<boolean>;+ ready: Accessor<boolean>;} {const query = useQuery(() => databaseWebhooksQueryOptions(databaseId()));return {@@ -35,6 +37,10 @@ export function useTableWebhooks(? query.data.webhooks.filter((webhook) => webhook.tableId === tableId()): undefined,failed: () => query.isError,+ ready: () =>+ query.isFetchedAfterMount &&+ query.isSuccess &&+ query.fetchStatus === 'idle',};}diff --git a/apps/web/src/features/block-database/views/database-page-actions.test.tsx b/apps/web/src/features/block-database/views/database-page-actions.test.tsxindex 4b250fcf53..5b0005d0a7 100644--- a/apps/web/src/features/block-database/views/database-page-actions.test.tsx+++ b/apps/web/src/features/block-database/views/database-page-actions.test.tsx@@ -1,4 +1,5 @@import { BlockItemSplitLabel } from '@components/app/split-layout/components/SplitLabel';+import { queryClient } from '@queries/client';import type { DatabaseDetail } from '@service-storage/generated/schemas/databaseDetail';import type { TableDetail } from '@service-storage/generated/schemas/tableDetail';import {@@ -9,8 +10,9 @@ import {waitFor,within,} from '@solidjs/testing-library';+import { QueryClientProvider } from '@tanstack/solid-query';import { errAsync, okAsync, type ResultAsync } from 'neverthrow';-import { createSignal, Show } from 'solid-js';+import { type Accessor, createSignal, Show } from 'solid-js';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { toast } from '../../../lib/core/component/Toast/Toast';import { DatabaseTitle } from '../../database/components/database-title';@@ -48,10 +50,20 @@ vi.mock('@components/app/split-layout/layoutUtils', () => ({const mocks = vi.hoisted(() => ({download: vi.fn(),csv: vi.fn(),+ listWebhooks: vi.fn(),+ createWebhook: vi.fn(),}));vi.mock('../../../lib/core/component/Toast/Toast', () => ({toast: { failure: vi.fn(), success: vi.fn() },}));+vi.mock('@service-storage/client', () => ({+ storageServiceClient: {+ databases: {+ listWebhooks: mocks.listWebhooks,+ createWebhook: mocks.createWebhook,+ },+ },+}));vi.mock('@filesystem/download', () => ({ downloadFile: mocks.download }));vi.mock('../queries/transfer', () => ({exportDatabaseTableCsv: mocks.csv,@@ -60,6 +72,21 @@ vi.mock('../queries/transfer', () => ({let presenceStyles: HTMLStyleElement;beforeEach(() => {+ queryClient.clear();+ mocks.listWebhooks.mockReset().mockReturnValue(okAsync({ webhooks: [] }));+ mocks.createWebhook.mockReset().mockImplementation(({ tableId }) =>+ okAsync({+ webhook: {+ id: `webhook-${tableId}`,+ databaseId: 'db',+ tableId,+ tokenPrefix: tableId,+ createdBy: 'user',+ createdAt: '2026-01-01T00:00:00Z',+ },+ token: `token-${tableId}`,+ })+ );presenceStyles = document.createElement('style');presenceStyles.textContent ='[role=menu], [role=dialog] { animation-name: none; }';@@ -71,6 +98,7 @@ beforeEach(() => {});afterEach(() => {cleanup();+ queryClient.clear();presenceStyles.remove();vi.restoreAllMocks();});@@ -80,7 +108,8 @@ function setup(remove = vi.fn((): ResultAsync<void, DatabaseEntityFailure> => okAsync(undefined)),- entityActions?: DatabaseEntityActions+ entityActions?: DatabaseEntityActions,+ selectedTable?: Accessor<TableDetail>) {let editTitle: (() => void) | undefined;const editReady = vi.fn((edit: (() => void) | undefined) => {@@ -88,35 +117,40 @@ function setup(});const [loaded, setLoaded] = createSignal(false);render(() => (- <>- <BlockItemSplitLabel- name={() => 'Customers'}- title={- <Show when={loaded()}>- <DatabaseTitle- name="Customers"- canEdit={grant !== 'view'}- onRename={vi.fn()}- onEditReady={editReady}- />- </Show>- }- />- <DatabasePageActions- detail={- {- database: { id: 'db', name: 'Customers', owner_id: 'owner' },- grant,- tables: [],- } as unknown as DatabaseDetail- }- table={{ table: { id: 'table', name: 'Contacts' } } as TableDetail}- entityActions={entityActions}- onImported={vi.fn()}- onRename={() => editTitle?.()}- onDelete={remove}- />- </>+ <QueryClientProvider client={queryClient}>+ <>+ <BlockItemSplitLabel+ name={() => 'Customers'}+ title={+ <Show when={loaded()}>+ <DatabaseTitle+ name="Customers"+ canEdit={grant !== 'view'}+ onRename={vi.fn()}+ onEditReady={editReady}+ />+ </Show>+ }+ />+ <DatabasePageActions+ detail={+ {+ database: { id: 'db', name: 'Customers', owner_id: 'owner' },+ grant,+ tables: [],+ } as unknown as DatabaseDetail+ }+ table={+ selectedTable?.() ??+ ({ table: { id: 'table', name: 'Contacts' } } as TableDetail)+ }+ entityActions={entityActions}+ onImported={vi.fn()}+ onRename={() => editTitle?.()}+ onDelete={remove}+ />+ </>+ </QueryClientProvider>));setLoaded(true);return { remove, editReady };@@ -300,3 +334,32 @@ describe('database page actions', () => {expect(remove).toHaveBeenCalledTimes(2);});});++it('remounts webhook state for a new table without remounting for metadata changes', async () => {+ const first: TableDetail = {+ table: {+ id: 'first',+ database_id: 'db',+ name: 'First',+ position: 'a',+ version: 1,+ },+ columns: [],+ views: [],+ sql_name: '"First"',+ };+ const [selected, setSelected] = createSignal(first);+ setup('owner', undefined, undefined, selected);+ await openMenu();+ selectItem('Webhooks');+ await screen.findByDisplayValue(/token-first/);+ setSelected({+ ...first,+ table: { ...first.table, id: 'second', name: 'Second' },+ });+ await screen.findByDisplayValue(/token-second/);+ expect(screen.queryByDisplayValue(/token-first/)).toBeNull();+ expect(mocks.createWebhook).toHaveBeenCalledTimes(2);+ setSelected({ ...selected() });+ expect(mocks.createWebhook).toHaveBeenCalledTimes(2);+});diff --git a/apps/web/src/features/block-database/views/database-page-actions.tsx b/apps/web/src/features/block-database/views/database-page-actions.tsxindex 7461265dc8..bf9a8e78e1 100644--- a/apps/web/src/features/block-database/views/database-page-actions.tsx+++ b/apps/web/src/features/block-database/views/database-page-actions.tsx@@ -273,12 +273,14 @@ export function DatabasePageActions(props: {</Show><Show when={webhooksOpen() && props.table}>{(table) => (- <WebhooksDialog- databaseId={props.detail.database.id}- table={table()}- onClose={() => setWebhooksOpen(false)}- returnFocus={menuButton}- />+ <Show keyed when={`${props.detail.database.id}:${table().table.id}`}>+ <WebhooksDialog+ databaseId={props.detail.database.id}+ table={table()}+ onClose={() => setWebhooksOpen(false)}+ returnFocus={menuButton}+ />+ </Show>)}</Show><DeleteDialogdiff --git a/apps/web/tests/functional/whatsapp-linked.spec.ts b/apps/web/tests/functional/whatsapp-linked.spec.tsindex 7edaaa8bbe..d45723a9a2 100644--- a/apps/web/tests/functional/whatsapp-linked.spec.ts+++ b/apps/web/tests/functional/whatsapp-linked.spec.ts@@ -620,6 +620,8 @@ test('External lists groups in Macro with unread counts and read-only tags', asytest('chats sort into direct messages, groups and communities on the page and in External', async ({page,}) => {+ // Three full fixture navigations share this test's timeout.+ test.slow();const state = server();state.account = {id: 'account-1',diff --git a/docs/agent-guide/databases.md b/docs/agent-guide/databases.mdindex 4312f9b6ff..6c4a2c4f89 100644--- a/docs/agent-guide/databases.md+++ b/docs/agent-guide/databases.md@@ -744,15 +744,25 @@ type menu afterward to convert it. The limit is 8 MB, 100 columns, and 10,000 roA failed response offers **Retry import** with the same request, so retrying acompleted import does not create a second table.-**Webhooks** (editors only) opens a dialog for the current table. **Create-webhook** shows its URL once, with a copy button and a `curl` example built from-the table's columns; the list below shows each webhook's token prefix and a-delete button. POSTing a JSON object to the URL inserts one row (an array inserts+**Webhooks** (editors only) opens a dialog for the current table (a drawer on+phones). After a fresh list response confirms the table has no webhooks,+opening it creates the first webhook and shows its URL directly, with a copy+button and a `curl` example built from the table's columns. Automatic creation+waits while the list request is paused offline. If webhooks already exist, it+opens management without creating another. Changing the active table resets+the dialog to that table. **Create webhook** creates another URL or retries a+failed creation. The dialog stays open while creation is pending. Each new URL is+shown only once; copy it before closing. The list+below shows each webhook's token prefix and a delete button. Deleting the last+webhook does not create a replacement until the dialog is reopened. POSTing a JSON object to the URL inserts one row (an array insertsone per object, up to 100). Keys name columns, ignoring case; `null` leaves acell empty; unknown keys or values that do not fit refuse the whole call with a400 listing every problem. The row is written as the webhook's creator, and thewebhook stops working if they lose edit access.+Browser examples: [desktop](media/database-webhooks/desktop.png) and+[phone](media/database-webhooks/phone.png).+## Side panel and activityThe split header's `Show Side Panel` toggle (or `]`) opens the shared floating details panel,diff --git a/docs/agent-guide/media/database-webhooks/desktop.png b/docs/agent-guide/media/database-webhooks/desktop.pngnew file mode 100644index 0000000000..079da0eef8Binary files /dev/null and b/docs/agent-guide/media/database-webhooks/desktop.png differdiff --git a/docs/agent-guide/media/database-webhooks/phone.png b/docs/agent-guide/media/database-webhooks/phone.pngnew file mode 100644index 0000000000..037e08d0f9Binary files /dev/null and b/docs/agent-guide/media/database-webhooks/phone.png differ