You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/10/21 20:36:38 UTC

(superset) 01/06: fix(home): refresh recent activity after dashboard/chart delete

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

rusackas pushed a commit to branch fix/39528-home-recent-activity-refresh
in repository https://gitbox.apache.org/repos/asf/superset.git

commit db7398096bc13f74432dd14fd804ef10981a8da0
Author: Puja Gupta <pu...@gmail.com>
AuthorDate: Tue Apr 21 23:55:20 2026 +0530

    fix(home): refresh recent activity after dashboard/chart delete
    
    - Added refreshKey state to trigger re-fetch of activity data
    - Added onActivityRefresh callback prop to DashboardTable and ChartTable
    - Activity section now updates automatically after delete operations
    
    Fixes #39435
---
 superset-frontend/src/features/home/ChartTable.tsx     | 13 ++++++++++---
 superset-frontend/src/features/home/DashboardTable.tsx |  2 ++
 superset-frontend/src/pages/Home/index.tsx             |  9 ++++++++-
 superset-frontend/src/views/CRUD/types.ts              |  1 +
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/features/home/ChartTable.tsx b/superset-frontend/src/features/home/ChartTable.tsx
index 2829634c362..452ff3187a5 100644
--- a/superset-frontend/src/features/home/ChartTable.tsx
+++ b/superset-frontend/src/features/home/ChartTable.tsx
@@ -59,6 +59,7 @@ interface ChartTableProps {
   otherTabData?: Array<object>;
   otherTabFilters: Filter[];
   otherTabTitle: string;
+  onActivityRefresh?: () => void;
 }
 
 function ChartTable({
@@ -70,6 +71,7 @@ function ChartTable({
   otherTabData,
   otherTabFilters,
   otherTabTitle,
+  onActivityRefresh,
 }: ChartTableProps) {
   const history = useHistory();
   const initialTab = getItem(
@@ -79,6 +81,7 @@ function ChartTable({
 
   const filteredOtherTabData = otherTabData?.filter(obj => 'viz_type' in obj);
 
+
   const {
     state: { loading, resourceCollection: charts, bulkSelectEnabled },
     setResourceCollection: setCharts,
@@ -94,6 +97,10 @@ function ChartTable({
     [],
     false,
   );
+  const handleRefreshData = () => {
+    refreshData();
+    onActivityRefresh?.();
+  };
 
   const chartIds = useMemo(() => charts.map(c => c.id), [charts]);
   const [saveFavoriteStatus, favoriteStatus] = useFavoriteStatus(
@@ -212,8 +219,8 @@ function ChartTable({
               const target =
                 activeTab === TableTab.Favorite
                   ? `/chart/list/?filters=(favorite:(label:${t(
-                      'Yes',
-                    )},value:!t))`
+                    'Yes',
+                  )},value:!t))`
                   : '/chart/list/';
               history.push(target);
             },
@@ -232,7 +239,7 @@ function ChartTable({
               hasPerm={hasPerm}
               showThumbnails={showThumbnails}
               bulkSelectEnabled={bulkSelectEnabled}
-              refreshData={refreshData}
+              refreshData={handleRefreshData}
               addDangerToast={addDangerToast}
               addSuccessToast={addSuccessToast}
               getData={getData}
diff --git a/superset-frontend/src/features/home/DashboardTable.tsx b/superset-frontend/src/features/home/DashboardTable.tsx
index 5289ab687d9..7c1d5f43840 100644
--- a/superset-frontend/src/features/home/DashboardTable.tsx
+++ b/superset-frontend/src/features/home/DashboardTable.tsx
@@ -60,6 +60,7 @@ function DashboardTable({
   otherTabData,
   otherTabFilters,
   otherTabTitle,
+  onActivityRefresh,
 }: DashboardTableProps) {
   const history = useHistory();
   const defaultTab = getItem(
@@ -268,6 +269,7 @@ function DashboardTable({
               getData,
             );
             setDashboardToDelete(null);
+            onActivityRefresh?.();
           }}
           onHide={() => setDashboardToDelete(null)}
           open={!!dashboardToDelete}
diff --git a/superset-frontend/src/pages/Home/index.tsx b/superset-frontend/src/pages/Home/index.tsx
index 82ff403b81e..2604a0afc60 100644
--- a/superset-frontend/src/pages/Home/index.tsx
+++ b/superset-frontend/src/pages/Home/index.tsx
@@ -172,6 +172,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
     null,
   );
   const [isFetchingActivityData, setIsFetchingActivityData] = useState(true);
+  const [refreshKey, setRefreshKey] = useState(0);
 
   const collapseState = getItem(LocalStorageKeys.HomepageCollapseState, []);
   const [activeState, setActiveState] = useState<Array<string>>(collapseState);
@@ -181,6 +182,10 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
     setItem(LocalStorageKeys.HomepageCollapseState, state);
   };
 
+  const handleRefreshActivity = () => {
+  setRefreshKey(prev => prev + 1);
+};
+
   const SubmenuExtension = extensionsRegistry.get('home.submenu');
   const WelcomeMessageExtension = extensionsRegistry.get('welcome.message');
   const WelcomeTopExtension = extensionsRegistry.get('welcome.banner');
@@ -294,7 +299,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
     ]).then(() => {
       setIsFetchingActivityData(false);
     });
-  }, [otherTabFilters]);
+  }, [otherTabFilters, refreshKey]);
 
   const handleToggle = () => {
     setChecked(!checked);
@@ -398,6 +403,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
                         otherTabData={activityData?.[TableTab.Other]}
                         otherTabFilters={otherTabFilters}
                         otherTabTitle={otherTabTitle}
+                        onActivityRefresh={handleRefreshActivity}
                       />
                     ),
                 },
@@ -418,6 +424,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
                               otherTabData={activityData?.[TableTab.Other]}
                               otherTabFilters={otherTabFilters}
                               otherTabTitle={otherTabTitle}
+                              onActivityRefresh={handleRefreshActivity}
                             />
                           ),
                       },
diff --git a/superset-frontend/src/views/CRUD/types.ts b/superset-frontend/src/views/CRUD/types.ts
index 08206bb0382..034d3fa9b32 100644
--- a/superset-frontend/src/views/CRUD/types.ts
+++ b/superset-frontend/src/views/CRUD/types.ts
@@ -50,6 +50,7 @@ export interface DashboardTableProps {
   otherTabData?: Array<Dashboard>;
   otherTabFilters: Filter[];
   otherTabTitle: string;
+  onActivityRefresh?: () => void; 
 }
 
 export interface Dashboard {