This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch fix-alert-report-tab-error
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/fix-alert-report-tab-error by 
this push:
     new 7f98456c93c fix(alerts): replace stale-anchor UI check with 
payload-level assertion
7f98456c93c is described below

commit 7f98456c93c9cb1e242fda3bb026e4184ee120cc
Author: Joe Li <[email protected]>
AuthorDate: Mon Feb 23 12:04:18 2026 -0800

    fix(alerts): replace stale-anchor UI check with payload-level assertion
    
    Trigger save after stale anchor is processed and inspect the PUT request
    body to verify extra.dashboard.anchor is undefined. This directly asserts
    the component state through its API boundary rather than checking DOM
    elements or i18n-dependent UI copy.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../src/features/alerts/AlertReportModal.test.tsx  | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx 
b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
index 73423dec7f2..af8914ffced 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
@@ -993,12 +993,29 @@ test('stale JSON array anchor is cleared without crash or 
toast', async () => {
       ),
     ).toBe(false);
 
-    // Verify anchor was cleared: the stale anchor value should not appear
-    // as a selected item anywhere (antd TreeSelect sets title={value} on
-    // selection items; absent title means updateAnchorState(undefined) ran)
+    // Verify anchor was cleared at the payload level: trigger save and
+    // inspect the PUT body to confirm extra.dashboard.anchor is undefined
+    const updateEndpoint = 'glob:*/api/v1/report/1';
+    fetchMock.put(updateEndpoint, { id: 1, result: {} }, { name: 
'put-report-1' });
+
+    const saveButton = screen.getByRole('button', { name: /save/i });
+    expect(saveButton).not.toBeDisabled();
+    userEvent.click(saveButton);
+
     await waitFor(() => {
-      expect(screen.queryByTitle(staleAnchor)).not.toBeInTheDocument();
+      const putCalls = fetchMock.callHistory
+        .calls()
+        .filter(c => c.url.includes('/api/v1/report/') && c.options?.method 
=== 'put');
+      expect(putCalls).toHaveLength(1);
     });
+
+    const putCall = fetchMock.callHistory
+      .calls()
+      .find(c => c.url.includes('/api/v1/report/') && c.options?.method === 
'put');
+    const body = JSON.parse(putCall!.options?.body as string);
+    expect(body.extra.dashboard.anchor).toBeUndefined();
+
+    fetchMock.removeRoute('put-report-1');
   } finally {
     restoreAnchorMocks();
   }

Reply via email to