sadpandajoe commented on code in PR #45589:
URL: https://github.com/apache/superset/pull/45589#discussion_r4362121507


##########
superset-frontend/src/pages/Home/index.tsx:
##########
@@ -214,28 +219,42 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
 
   useEffect(() => {
     if (!otherTabFilters || WelcomeMainExtension) {
-      return;
+      return undefined;
     }
+    // Guards against out-of-order responses: if `refreshKey` changes again
+    // (e.g. a rapid follow-up delete) before this run's requests resolve,
+    // its results are discarded instead of overwriting newer state.
+    let isStale = false;

Review Comment:
   The new refresh path in this effect (the `refreshKey` refetch, the `isStale` 
discard, and the first-load-only tab/collapse restore) isn't exercised by any 
test: `Home.test.tsx` only covers the initial load, and the changed 
`ChartTable`/`DashboardTable` tests only assert that `onActivityRefresh` is 
called. Both would still pass if the stale guard or the `refreshKey === 0` gate 
were removed. Could you add a Home-level test that triggers a delete, asserts 
the recents endpoints are refetched and `activeChild` / collapse state are left 
alone, and defers two refreshes (resolving the newer one first) to assert the 
older response can't repopulate the deleted item?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to