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


##########
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:
   Added `Home.refresh.test.tsx`: it asserts a delete refetches recents and 
dashboards while leaving the selected tab alone, and defers two refreshes, 
resolving the newer one first, to check the older response cannot bring the 
deleted item back. Both tests go red if I remove the `isStale` guard or the 
`refreshKey === 0` gate.



-- 
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