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

jli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e88649730 fix: thumbnail url json response was malformed (#29938)
7e88649730 is described below

commit 7e886497306d78788ba699a7236a94d393fa68fa
Author: Elizabeth Thompson <[email protected]>
AuthorDate: Mon Aug 19 11:08:39 2024 -0700

    fix: thumbnail url json response was malformed (#29938)
---
 .../src/features/dashboards/DashboardCard.test.tsx             | 10 ++++------
 superset-frontend/src/features/dashboards/DashboardCard.tsx    |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/src/features/dashboards/DashboardCard.test.tsx 
b/superset-frontend/src/features/dashboards/DashboardCard.test.tsx
index 84c6daa68a..84d7a693d8 100644
--- a/superset-frontend/src/features/dashboards/DashboardCard.test.tsx
+++ b/superset-frontend/src/features/dashboards/DashboardCard.test.tsx
@@ -18,7 +18,7 @@
  */
 
 import { MemoryRouter } from 'react-router-dom';
-import { FeatureFlag, SupersetClient } from '@superset-ui/core';
+import { FeatureFlag, JsonResponse, SupersetClient } from '@superset-ui/core';
 import * as uiCore from '@superset-ui/core';
 
 import { render, screen, waitFor } from 'spec/helpers/testing-library';
@@ -101,11 +101,9 @@ it('Renders the modified date', () => {
 
 it('should fetch thumbnail when dashboard has no thumbnail URL and feature 
flag is enabled', async () => {
   const mockGet = jest.spyOn(SupersetClient, 'get').mockResolvedValue({
-    response: new Response(
-      JSON.stringify({ thumbnail_url: '/new-thumbnail.png' }),
-    ),
-    json: () => Promise.resolve({ thumbnail_url: '/new-thumbnail.png' }),
-  });
+    json: { result: { thumbnail_url: '/new-thumbnail.png' } },
+  } as unknown as JsonResponse);
+
   const { rerender } = render(
     <DashboardCard
       dashboard={{
diff --git a/superset-frontend/src/features/dashboards/DashboardCard.tsx 
b/superset-frontend/src/features/dashboards/DashboardCard.tsx
index 1a1ae0e6e6..5eb02aeab8 100644
--- a/superset-frontend/src/features/dashboards/DashboardCard.tsx
+++ b/superset-frontend/src/features/dashboards/DashboardCard.tsx
@@ -91,7 +91,7 @@ function DashboardCard({
       SupersetClient.get({
         endpoint: `/api/v1/dashboard/${dashboard.id}`,
       }).then(({ json = {} }) => {
-        setThumbnailUrl(json.thumbnail_url || '');
+        setThumbnailUrl(json.result?.thumbnail_url || '');
         setFetchingThumbnail(false);
       });
     }

Reply via email to