Copilot commented on code in PR #35964:
URL: https://github.com/apache/superset/pull/35964#discussion_r2501071552


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx:
##########
@@ -470,12 +505,28 @@ const FiltersConfigForm = (
           }
         })
         .catch((error: Response) => {
-          getClientErrorObject(error).then(clientErrorObject => {
-            setError(clientErrorObject);
-          });
+          if (isMountedRef.current && requestId >= latestRequestIdRef.current) 
{
+            getClientErrorObject(error).then(clientErrorObject => {
+              if (
+                isMountedRef.current &&
+                requestId >= latestRequestIdRef.current
+              ) {
+                setError(clientErrorObject);
+              }
+            });
+          }
         });
     },
-    [filterId, forceUpdate, form, formFilter, hasDataset, dependenciesText],
+    [
+      filterId,
+      forceUpdate,
+      form,
+      formFilter,
+      hasDataset,
+      dependenciesText,
+      isMountedRef,
+      latestRequestIdRef,

Review Comment:
   The `isMountedRef` and `latestRequestIdRef` should not be included in the 
dependency array of `useCallback`. Refs are stable and don't trigger 
re-renders, so including them serves no purpose and may confuse readers about 
the actual dependencies. Remove them from the dependency array.
   ```suggestion
         // isMountedRef and latestRequestIdRef are refs and should not be 
included
   ```



##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.test.tsx:
##########
@@ -0,0 +1,914 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Review Comment:
   The license header is incomplete. Line 14 should read "AS IS" BASIS instead 
of just "IS" BASIS.
   ```suggestion
    * AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   ```



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